Slide 1

Slide 1 text

@DAlooG SWIFT AND FLUX New age of iOS development 1

Slide 2

Slide 2 text

@DAlooG ABOUT ME ➤iOS Developer at Sigma Software ➤Enterprise and client applications ➤Team leader ➤Mentor ➤Consultant 2

Slide 3

Slide 3 text

@DAlooG OBJECTIVE C And messed view controllers 3

Slide 4

Slide 4 text

@DAlooG PRE IPAD ➤Single UIViewController at screen ➤Single static layout ➤Table based layout 4

Slide 5

Slide 5 text

@DAlooG APPLE SOLUTION https://developer.apple.com/library/ios/documentation/General/Conceptual/ CocoaEncyclopedia/Model-View-Controller/Model-View-Controller.html#//apple_ref/doc/ uid/TP40010810-CH14-SW14 5

Slide 6

Slide 6 text

@DAlooG IPAD - SIZE CLASSES ➤Containment API ➤AutoLayout ➤Network availability ➤Storyboards 6

Slide 7

Slide 7 text

@DAlooG APPLE SOLUTION https://developer.apple.com/library/ios/documentation/General/Conceptual/DevPedia- CocoaCore/MVC.html 7

Slide 8

Slide 8 text

@DAlooG PROBLEMS ➤Controller need to rule view and model layers ➤View receive updates. So order of updates is important ➤Model receive updates. So order of updates is important ➤Controller is bloated with responsibilities 8

Slide 9

Slide 9 text

@DAlooG COMPONENT KIT http://componentkit.org 9

Slide 10

Slide 10 text

@DAlooG REACT https://facebook.github.io/react/ 10

Slide 11

Slide 11 text

« @DAlooG I say with confidence as a former UIKit author: React's model for the UI layer is vastly better than UIKit's. React Native is a *huge* deal. https://twitter.com/andy_matuschak/ status/560511204867575808 11

Slide 12

Slide 12 text

@DAlooG UI = VIEW(DATA) View layer is an function from data to user interface 12

Slide 13

Slide 13 text

« @DAlooG One can merge the MVC roles played by an object, making an object, for example, fulfill both the controller and view roles—in which case, it would be called a view controller. http://apple.co/1U6DPF3 13

Slide 14

Slide 14 text

@DAlooG UIVC == VIEW 14

Slide 15

Slide 15 text

@DAlooG VIEW LAYER PROPS ➤Data driven ➤Testable ➤No state ➤No context 15

Slide 16

Slide 16 text

@DAlooG PRE SWIFT ➤VIPER ➤MVVM ➤Reactive Programming (mostly RAC) 16

Slide 17

Slide 17 text

@DAlooG SWIFT 17

Slide 18

Slide 18 text

@DAlooG PROMISED LAND ➤Modern syntax ➤Generics ➤Enums ➤Structs ➤Closures ➤Protocols 18

Slide 19

Slide 19 text

@DAlooG APPLE SOLUTION https://developer.apple.com/library/ios/documentation/General/Conceptual/DevPedia- CocoaCore/MVC.html 19

Slide 20

Slide 20 text

@DAlooG SERIOUSLY? 20

Slide 21

Slide 21 text

@DAlooG FLUX https://facebook.github.io/flux/ 21

Slide 22

Slide 22 text

@DAlooG ➤Store ➤View ➤Action ➤Dispatcher 22

Slide 23

Slide 23 text

@DAlooG ACTION / COMMAND ➤Representation of increment ➤User actions (tap, gestures, shake) ➤API callbacks ➤Timer events ➤Action is immutable ➤Action is serializable ➤Action is printable 23

Slide 24

Slide 24 text

@DAlooG ACTION / COMMAND 24

Slide 25

Slide 25 text

@DAlooG STORE / REDUCER / UPDATE ➤Stores data ➤Update data according to actions ➤Notify listeners about data updates ➤Most application logic lives here ➤Covered with Unit Tests ➤Implemented as class 25

Slide 26

Slide 26 text

@DAlooG STATE ➤Immutable value type ➤Valid most of the times ➤Domain specific ➤Implemented as struct 26

Slide 27

Slide 27 text

@DAlooG ➤Store ➤View ➤Action ➤Dispatcher 27

Slide 28

Slide 28 text

@DAlooG WHY? 28

Slide 29

Slide 29 text

@DAlooG CQRS http://martinfowler.com/bliki/CQRS.html 29

Slide 30

Slide 30 text

@DAlooG 30

Slide 31

Slide 31 text

@DAlooG 31

Slide 32

Slide 32 text

@DAlooG Service Client Query Command CQRS 32

Slide 33

Slide 33 text

@DAlooG LINKS ➤http://blog.benjamin-encz.de/a-flux-inspired-architecture- for-ios/ ➤https://developer.apple.com/library/ios/documentation/ General/Conceptual/CocoaEncyclopedia/Model-View- Controller/Model-View-Controller.html#//apple_ref/doc/ uid/TP40010810-CH14 ➤https://developer.apple.com/library/ios/documentation/ General/Conceptual/DevPedia-CocoaCore/MVC.html ➤https://github.com/yonekawa/SwiftFlux ➤https://github.com/ReduxKit/ReduxKit ➤https://github.com/ReSwift/ReSwift

Slide 34

Slide 34 text

@DAlooG Q? [email protected] 34