SlideShare a Scribd company logo
Рак мозга или мозг рака
Раком можно все
1023
A for Architecture
•Application Layer
•Transport Layer
•Service Layer
•Model Layer
•ViewModel Layer
•View Layer
•Application Layer
•Transport Layer
•Service Layer
•Model Layer
•ViewModel Layer
•View Layer
Persistence
Notifications
Runtime
•Application Layer
•Transport Layer
•Service Layer
•Model Layer
•ViewModel Layer
•View Layer
NSNotification
LocationUpdate
•Application Layer
•Transport Layer
•Service Layer
•Model Layer
•ViewModel Layer
•View Layer
Networking
Networking policies
•Application Layer
•Transport Layer
•Service Layer
•Model Layer
•ViewModel Layer
•View Layer
HTTP.Request
HTTP.Response
HTTP.Error
•Application Layer
•Transport Layer
•Service Layer
•Model Layer
•ViewModel Layer
•View Layer
API Request
Persistence Request
Application Service wrapper
•Application Layer
•Transport Layer
•Service Layer
•Model Layer
•ViewModel Layer
•View Layer
Update request
Value Object
Service Object
•Application Layer
•Transport Layer
•Service Layer
•Model Layer
•ViewModel Layer
•View Layer
Business logic
Logic state
•Application Layer
•Transport Layer
•Service Layer
•Model Layer
•ViewModel Layer
•View Layer
Model Object
•Application Layer
•Transport Layer
•Service Layer
•Model Layer
•ViewModel Layer
•View Layer
Application State
Presentation Logic
•Application Layer
•Transport Layer
•Service Layer
•Model Layer
•ViewModel Layer
•View Layer
Bindings
Presentables
•Application Layer
•Transport Layer
•Service Layer
•Model Layer
•ViewModel Layer
•View Layer
Presentation
UI State
•Application Layer
•Transport Layer
•Service Layer
•Model Layer
•ViewModel Layer
•View Layer
Presenters
UIObjects
Foundation Types
Data Flow
1024
Data + Data Request Flow
Transport Layer
Transport Layer
Transport Layer + Errors
Transport Layer + Binding
And now?
RAC
• Signal
• SignalProducer
• Action
• Property
• Result
RAC
• Signal
• SignalProducer
• Action
• Property
• Result
• Pipeline
• Future Task
• Future Builder
• Reactive State
• Enum<Value | Error>
RAC
• Signal
• SignalProducer
• Action
• Property
• Result
• NSNotificationCenter
• startWithCompletion:
• startWithInput:Completions
• value + KVO
• completions(result, error)
RAC + Transforms
• Signal -> Signal - Operator
• Signal.map(transform)
• Signal.retry(3)
• Signal -> Signal -> Signal - pipeline
- retry(map(signal, transform), 3)
✓ signal.map(transform).retry(3)
RAC + (flat)map
Transport Layer + RAC
Transport Layer + RAC
let requestAction = Action<URLRequest, URLResponse, Error> { .../*future task*/ }
let http = Action<Request, Response, Error> { request in
return Result<Request, Error>(value: request)
.flatMap(serialize) //Result<JSON, Error>
.flatMap(requestBuilder(forConfiguration: configuration)) //Result<URLRequest, Error>
.map(SignalProducer.init) //SignalProducer<URLRequest, Error>
.flatMap(.Latest, transform: requestAction.apply) //SignalProducer<URLResponse, Error>
.attemptMap(deserialize) //SignalProducer<Response Error
}
Заметьте - эта штука вполне может
быть общей вне зависимости от
входных и выходных данных засчет
generic
Build Your Own RAC
extension SignalType {
/// Returns a signal that will yield an array of values when `self` completes.
@warn_unused_result(message="Did you forget to call `observe` on the signal?")
public func collect() -> Signal<[Value], Error> {
return self
.reduce(CollectState()) { $0.append($1) }
.map { $0.values }
}
}
Transport Layer + RAC
let httpWithPolicy = Action<Request, Response, Error> { request in
http.apply(request)
.retry(3)
.suspendOn(enterBackgroundSignal: background, enterForeground: foreground)
}
Service Layer
Service Layer
Service Layer + RAC
let service = Action<Number, Image, Error> { number in
let image = cacheService.inquire
.apply(number)
.concat { xkcdImageHTTP.apply(number) }
let description = xkcdDescriptionHTTP.apply(number)
return combineLatest(image, description).map { ImageWithDescription(image: $0, description: $1) }
}
Model Layer
Model Layer
Model Layer + RAC
struct State {
let number: Int
let value: AnyProperty<ImageWithDescription?>
init(number: Int) {
self.number = number
self.value = AnyProperty(value: nil, producer: service.apply(number))
}
}
let state = MutableProperty(State(number: 100))
let increment = { number.value = State(number: number.value.number + 1) }
let exposedState = AnyProperty(state)
View Model Layer
View Model Layer
VM Layer + RAC
let image = model.exposedState
.flatMap { $0.value.image }
.map { $0 ?? imagePlaceholder }
let description = model.exposedState
.flatMap { $0.value.description }
.map { $0 ?? "Loading..." }
let rightButtonAction = model.increment
let present = { presenters in
presenters.rightButtonAction <~ rightButtonAction
presenters.description <~ description.producer
presenters.image <~ description.image
}
View Layer
View + RAC
class View {
//{ self.imageView.image = $0 }
let image: Presenter<UIImage> = self.imageView.imagePresenter
//{ self.descriptionLabel.value = $0 }
let description: Presenter<String> = self.descriptionLabel.textPresenter
//{ self.button.clickedSignal.observe($0) }
let rightButton: Presenter<() -> ()> = self.button.clickActionPresenter
}
Hm…
Benefits?
• Consistency
• Observability
• Testability
• Encapsulation
• Completeness
Examples?
Popup Action
Navigation Property + Actions
UIKit Sinks + Presentables
Login Form Action + Operators
What’s next?
• RXMarbles (http://rxmarbles.com/)
• Reactive Cocoa sources - all here
Questions?

More Related Content

PDF
My Top 5 APEX JavaScript API's
PDF
Lift 2 0
 
PPT
Developing A Real World Logistic Application With Oracle Application - UKOUG ...
PDF
Tweaking the interactive grid
PDF
jQuery - Chapter 4 - DOM Handling
PPTX
Creating sub zero dashboard plugin for apex with google
PDF
JavaCro 2014 Scala and Java EE 7 Development Experiences
PDF
Intro to GraphQL on Android with Apollo DroidconNYC 2017
My Top 5 APEX JavaScript API's
Lift 2 0
 
Developing A Real World Logistic Application With Oracle Application - UKOUG ...
Tweaking the interactive grid
jQuery - Chapter 4 - DOM Handling
Creating sub zero dashboard plugin for apex with google
JavaCro 2014 Scala and Java EE 7 Development Experiences
Intro to GraphQL on Android with Apollo DroidconNYC 2017

What's hot (20)

PDF
No internet? No Problem!
PDF
jQuery - Chapter 5 - Ajax
PPTX
Client-side Rendering with AngularJS
PDF
Cycle.js - Functional reactive UI framework (Nikos Kalogridis)
PDF
Cycle.js - A functional reactive UI framework
PDF
Reporting solutions for ADF Applications
PPTX
20141001 delapsley-oc-openstack-final
PDF
Learn Ajax here
PDF
Workshop 23: ReactJS, React & Redux testing
PDF
BOF2644 Developing Java EE 7 Scala apps
PDF
Workshop 26: React Native - The Native Side
PDF
Streams or Loops? Java 8 Stream API by Niki Petkov - Proxiad Bulgaria
PDF
[QE 2018] Łukasz Gawron – Testing Batch and Streaming Spark Applications
PDF
From android/ java to swift (2)
PDF
Vaadin+Scala
KEY
Scalaz
PDF
Emerging Languages: A Tour of the Horizon
PDF
Reactive data visualisations with Om
PDF
RichFaces: more concepts and features
PDF
Workshop 25: React Native - Components
No internet? No Problem!
jQuery - Chapter 5 - Ajax
Client-side Rendering with AngularJS
Cycle.js - Functional reactive UI framework (Nikos Kalogridis)
Cycle.js - A functional reactive UI framework
Reporting solutions for ADF Applications
20141001 delapsley-oc-openstack-final
Learn Ajax here
Workshop 23: ReactJS, React & Redux testing
BOF2644 Developing Java EE 7 Scala apps
Workshop 26: React Native - The Native Side
Streams or Loops? Java 8 Stream API by Niki Petkov - Proxiad Bulgaria
[QE 2018] Łukasz Gawron – Testing Batch and Streaming Spark Applications
From android/ java to swift (2)
Vaadin+Scala
Scalaz
Emerging Languages: A Tour of the Horizon
Reactive data visualisations with Om
RichFaces: more concepts and features
Workshop 25: React Native - Components
Ad

Similar to iOS Reactive Cocoa Pipeline (20)

PDF
Rack
PDF
Rethinking Syncing at AltConf 2019
PPTX
Ntg web services
PDF
Using Apache Calcite for Enabling SQL and JDBC Access to Apache Geode and Oth...
PDF
Universal JavaScript
PPTX
SharePoint REST vs CSOM
PDF
Dev309 from asgard to zuul - netflix oss-final
ODP
Interoperable Web Services with JAX-WS and WSIT
PPTX
An Application Centric Approach to Devops
PDF
Spring Web Services: SOAP vs. REST
PDF
les07.pdf
PPTX
Data Pipeline at Tapad
PDF
GDG Devfest 2019 - Build go kit microservices at kubernetes with ease
PPTX
Serverless in-action
PDF
Unleashing your Kafka Streams Application Metrics!
PDF
Apache Samza 1.0 - What's New, What's Next
PPTX
apidays LIVE Australia 2020 - Building distributed systems on the shoulders o...
PDF
A real-world Relay application in production - Stefano Masini - Codemotion Am...
PDF
Introduction to CloudStack API
PDF
The use case of a scalable architecture
Rack
Rethinking Syncing at AltConf 2019
Ntg web services
Using Apache Calcite for Enabling SQL and JDBC Access to Apache Geode and Oth...
Universal JavaScript
SharePoint REST vs CSOM
Dev309 from asgard to zuul - netflix oss-final
Interoperable Web Services with JAX-WS and WSIT
An Application Centric Approach to Devops
Spring Web Services: SOAP vs. REST
les07.pdf
Data Pipeline at Tapad
GDG Devfest 2019 - Build go kit microservices at kubernetes with ease
Serverless in-action
Unleashing your Kafka Streams Application Metrics!
Apache Samza 1.0 - What's New, What's Next
apidays LIVE Australia 2020 - Building distributed systems on the shoulders o...
A real-world Relay application in production - Stefano Masini - Codemotion Am...
Introduction to CloudStack API
The use case of a scalable architecture
Ad

Recently uploaded (20)

PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
ai tools demonstartion for schools and inter college
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
medical staffing services at VALiNTRY
PDF
Nekopoi APK 2025 free lastest update
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Design an Analysis of Algorithms I-SECS-1021-03
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Design an Analysis of Algorithms II-SECS-1021-03
Odoo POS Development Services by CandidRoot Solutions
ai tools demonstartion for schools and inter college
Operating system designcfffgfgggggggvggggggggg
How Creative Agencies Leverage Project Management Software.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
medical staffing services at VALiNTRY
Nekopoi APK 2025 free lastest update
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Understanding Forklifts - TECH EHS Solution
Which alternative to Crystal Reports is best for small or large businesses.pdf
Upgrade and Innovation Strategies for SAP ERP Customers
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
VVF-Customer-Presentation2025-Ver1.9.pptx
Wondershare Filmora 15 Crack With Activation Key [2025
Softaken Excel to vCard Converter Software.pdf
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Design an Analysis of Algorithms I-SECS-1021-03

iOS Reactive Cocoa Pipeline