Upload
ua-mobile
View
436
Download
1
Embed Size (px)
Citation preview
@DAlooG
SWIFT AND FLUXNew age of iOS development
1
@DAlooG
ABOUT ME➤iOS Developer at Sigma Software ➤Enterprise and client applications ➤Team leader ➤Mentor ➤Consultant
2
@DAlooG
OBJECTIVE CAnd messed view controllers
3
@DAlooG
PRE IPAD➤Single UIViewController at screen ➤Single static layout ➤Table based layout
4
@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
@DAlooG
IPAD - SIZE CLASSES➤Containment API ➤AutoLayout ➤Network availability ➤Storyboards
6
@DAlooG
APPLE SOLUTION
https://developer.apple.com/library/ios/documentation/General/Conceptual/DevPedia-CocoaCore/MVC.html
7
@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
«
@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
@DAlooG
UI = VIEW(DATA)View layer is an function from data to user
interface
12
«
@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/1U6DPF313
@DAlooG
UIVC == VIEW
14
😱
@DAlooG
VIEW LAYER PROPS➤Data driven ➤Testable ➤No state ➤No context
15
@DAlooG
PRE SWIFT➤VIPER ➤MVVM ➤Reactive Programming (mostly RAC)
16
@DAlooG
SWIFT
17
@DAlooG 🦄
PROMISED LAND➤Modern syntax ➤Generics ➤Enums ➤Structs ➤Closures ➤Protocols
18
@DAlooG
APPLE SOLUTION
https://developer.apple.com/library/ios/documentation/General/Conceptual/DevPedia-CocoaCore/MVC.html
19
@DAlooG
SERIOUSLY?
20
@DAlooG
➤Store ➤View ➤Action ➤Dispatcher
22🔭
@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
@DAlooG
ACTION / COMMAND
24
@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
@DAlooG
STATE➤Immutable value type ➤Valid most of the times ➤Domain specific
➤Implemented as struct
26
@DAlooG
➤Store ➤View ➤Action ➤Dispatcher
27
@DAlooG
WHY?
28
@DAlooG 30
@DAlooG 31
@DAlooG
Service Client
Query
Command
CQRS
32
@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