6. • in 4 parts
• good for medium to big size applications
• good separation of responsibility
• loosely coupled components
SPLIT UP VIEW CONTROLLER
7. • connection between components is achieved using protocols
• composition instead inheritance in most cases
• most of UI is done in Storyboards but without Segues
GENERAL
8. • View / View Controller
• Presenter (view model :))
• Interactor
• Wireframe
MAIN COMPONENTS
11. • business logic agnostic
• knows how to layout itself
• reusable
VIEW / VIEW CONTROLLER
12. • business logic
• least reusable part
• has reference to
• view
• interactor
• wireframe
• models data received from interactor
• views delegate (responds to view events)
PRESENTER
13. • has the data
• knows how to get the data
INTERACTOR
14. • knows how to navigate
• knows how to create other VIPER modules
WIREFRAME
16. • FRP
• functional programming
• functions don’t have side effects, no mutable state
• difficult to program since real world is all about side effects
• reactive programming
• changes propagate throughout a system automatically
• functional reactive programming
• we model user input as a function that changes over time,
abstracting away the idea of mutable state
CREATED BY MICROSOFT (RX.NET)
17. • sweet spot between functional and imperative programming world
• unifies various design patterns (GoF)
• Delegate
• Callback (Closures, Blocks)
• KVO
• Notifications
• Observer
• enables building apps in declarative style
WHY RX?
22. • pull based interface
• good for traversing collections
• standard interface
• generator
• next (pull)
• no more data
• throw (error)
• arrays, dictionaries, sets
ITERATOR
23. • a collection of protocols
• CollectionType
• SequenceType
• GeneratorType
ITERATOR IN SWIFT
33. • unifying Iterator and Observer pattern
• can be composed
• we already know how to do operations on collections
• map
• filter
• reduce
• the equivalence of observer pattern (Observable<Element>
sequence) and normal sequences (SequenceType) is the most
important thing to understand about Rx
GENERAL
34. • every observable sequence is just a sequence
• push interface (aka callback)
• regex
• next* (error | completed)?
• can have 0 or more elements
• once error or completed
• sequence cannot produce any other element
• all internal resources will be disposed
• no work will be performed until you call subscribe
OBSERVABLES AKA SEQUENCES