SlideShare a Scribd company logo
1 of 15
Download to read offline
RxSwift
Krunoslav Zaher #fivenyc
Problem
! Kognitivna kompleksnost sustava
! Stanje (kompleksnost, cachevi)
! Višedretvenost (Multithreading)
! Upravljanje resursima
! Oporavak od grešaka
2
Kako rješiti ovaj problem
! https://www.youtube.com/watch?v=MseMobwg_mo

Bruce Lee: Right. Right. You see, actually, I do not teach, you know, Karate, because I
do not believe in styles anymore. I mean I do not believe that there is such thing as,
like, a Chinese way of fighting or a Japanese way of fighting...or whatever way of
fighting, because unless a human being has three arms and four legs, there can be no
different form of fighting. But, basically, we only have two hands and two feet. So
styles tend to, not only separate man because they have their own doctrines and the
doctrine became the gospel truth that you cannot change! But, if you do not have
styles, if you just say, "here I am as a human being, how can I express myself totally
and completely?" ...now that way, you won't create a style because style is a
crystallization. That way is a process of continuing growth.
! Problem je univerzalan, zato i rješenje treba biti dovoljno
općenito za sve platforme i okruženje
3
Stanje
var value: Something
4
Evolucija
! Callbacks
! Futures/Promises
5
! Scala/Haskell
! Rx
Rx
! matematička abstrakcija (monad)
! kompozicija, kompozicija, kompozicija …
! Microsoft Research - Erik Meijer
! poligotna implementacija (Swift, Java,
Js, .NET, Clojure, Kotlin)
! Martin Fowler - observer pattern? no :(
6
Rx
BASH (datoteka program.sh)
! git diff | grep bug | less
! ./program.sh
RxSwift
! gitDiff() >- grep(“bug") >- less
! >- subscribeNext …
7
RxSwift
let a = Variable(1)
let b = Variable(2)
let c: /* Observable<String> */ = combineLatest(a, b) { $0 + $1 }
>- filter { $0 >= 0 }
>- map { "($0) is positive" }
c >- subscribeNext { println($0) } // prints: 3 is positive

…

a.next(4) // prints: 6 is positive
b.next(-8) // doesn't print anything
a.next(9) // prints: 1 is positive
8
RxSwift
! RxSwift je verzija Rx-a za Swift
! Istrazivanje + razvoj je trajao 7 mjesec weekenda :)
! Objavljen na GH sredinom 4. mjeseca (2015)
! ispiriran je originalnom verzijom Rx.NET koja je evoluirala
proteklih 6 godina
! RxSwift je poprilično stabilan i spreman za produkcijsku
upotrebu
! ~30k linija swift koda, 430 unit testova
9
Kako početi koristiti
! postoje neke očite primjene
! throttling, autocomplete, image loader,
NSFetchedResultsController, NSNotificationCenter,
delegati
! nije sve ili ništa
! moguće je napisati samo dijelove aplikacije reaktivno, a
ostatak imperativno
! tko će naučiti sve te operatore
! što ako nema nekog operatora
10
Zamke
! za naprednije primjene bilo bi dobro imati dublje
shvaćanje kako Rx radi
! obično imperativni način razmišljanja je velika prepreka
! savjet, prvo naučite Haskell :)))
! nije silver bullet
11
Konkurencija
• ReactiveCocoa
• ReactKit
• RxSwift - JSS
• RxSwift - NM
• DeLorean
• PromiseKit
• Bolts
12
Budućnost - postoji :)
13
http://five.agency/about/careers/
HVALA!

More Related Content

More from Infinum

More from Infinum (20)

Infinum Android Talks #20 - Benefits of using Kotlin
Infinum Android Talks #20 - Benefits of using KotlinInfinum Android Talks #20 - Benefits of using Kotlin
Infinum Android Talks #20 - Benefits of using Kotlin
 
Infinum iOS Talks #4 - Making our VIPER more reactive
Infinum iOS Talks #4 - Making our VIPER more reactiveInfinum iOS Talks #4 - Making our VIPER more reactive
Infinum iOS Talks #4 - Making our VIPER more reactive
 
Infinum iOS Talks #4 - Making your Swift networking code more awesome with Re...
Infinum iOS Talks #4 - Making your Swift networking code more awesome with Re...Infinum iOS Talks #4 - Making your Swift networking code more awesome with Re...
Infinum iOS Talks #4 - Making your Swift networking code more awesome with Re...
 
Infinum Android Talks #13 - Using ViewDragHelper
Infinum Android Talks #13 - Using ViewDragHelperInfinum Android Talks #13 - Using ViewDragHelper
Infinum Android Talks #13 - Using ViewDragHelper
 
Infinum Android Talks #14 - Log4j
Infinum Android Talks #14 - Log4jInfinum Android Talks #14 - Log4j
Infinum Android Talks #14 - Log4j
 
Infinum Android Talks #9 - Making your app location-aware
Infinum Android Talks #9 - Making your app location-awareInfinum Android Talks #9 - Making your app location-aware
Infinum Android Talks #9 - Making your app location-aware
 
Infinum Android Talks #14 - Gradle plugins
Infinum Android Talks #14 - Gradle pluginsInfinum Android Talks #14 - Gradle plugins
Infinum Android Talks #14 - Gradle plugins
 
Infinum Android Talks #14 - Facebook for Android API
Infinum Android Talks #14 - Facebook for Android APIInfinum Android Talks #14 - Facebook for Android API
Infinum Android Talks #14 - Facebook for Android API
 
Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...
Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...
Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...
 
Infinum Android Talks #18 - Create fun lists by Ivan Marić
Infinum Android Talks #18 - Create fun lists by Ivan MarićInfinum Android Talks #18 - Create fun lists by Ivan Marić
Infinum Android Talks #18 - Create fun lists by Ivan Marić
 
Infinum Android Talks #18 - In-app billing by Ivan Marić
Infinum Android Talks #18 - In-app billing by Ivan MarićInfinum Android Talks #18 - In-app billing by Ivan Marić
Infinum Android Talks #18 - In-app billing by Ivan Marić
 
Infinum Android Talks #18 - How to cache like a boss by Željko Plesac
Infinum Android Talks #18 - How to cache like a boss by Željko PlesacInfinum Android Talks #18 - How to cache like a boss by Željko Plesac
Infinum Android Talks #18 - How to cache like a boss by Željko Plesac
 
Infinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
Infinum iOS Talks #2 - VIPER for everybody by Damjan VujaklijaInfinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
Infinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
 
Infinum iOS Talks #2 - Xamarin by Ivan Đikić
Infinum iOS Talks #2 - Xamarin by Ivan ĐikićInfinum iOS Talks #2 - Xamarin by Ivan Đikić
Infinum iOS Talks #2 - Xamarin by Ivan Đikić
 
Infinum iOS Talks #1 - Swift under the hood: Method Dispatching by Vlaho Poluta
Infinum iOS Talks #1 - Swift under the hood: Method Dispatching by Vlaho PolutaInfinum iOS Talks #1 - Swift under the hood: Method Dispatching by Vlaho Poluta
Infinum iOS Talks #1 - Swift under the hood: Method Dispatching by Vlaho Poluta
 
Infinum iOS Talks #1 - Swift done right by Ivan Dikic
Infinum iOS Talks #1 - Swift done right by Ivan DikicInfinum iOS Talks #1 - Swift done right by Ivan Dikic
Infinum iOS Talks #1 - Swift done right by Ivan Dikic
 
Infinum iOS Talks #1 - Becoming an iOS developer swiftly by Vedran Burojevic
Infinum iOS Talks #1 - Becoming an iOS developer swiftly by Vedran BurojevicInfinum iOS Talks #1 - Becoming an iOS developer swiftly by Vedran Burojevic
Infinum iOS Talks #1 - Becoming an iOS developer swiftly by Vedran Burojevic
 
Infinum Android Talks #17 - Testing your Android applications by Ivan Kust
Infinum Android Talks #17 - Testing your Android applications by Ivan KustInfinum Android Talks #17 - Testing your Android applications by Ivan Kust
Infinum Android Talks #17 - Testing your Android applications by Ivan Kust
 
Infinum Android Talks #17 - A quest for WebSockets by Zeljko Plesac
Infinum Android Talks #17 - A quest for WebSockets by Zeljko PlesacInfinum Android Talks #17 - A quest for WebSockets by Zeljko Plesac
Infinum Android Talks #17 - A quest for WebSockets by Zeljko Plesac
 
Infinum Android Talks #17 - Developing an Android library by Dino Kovac
Infinum Android Talks #17 - Developing an Android library  by Dino KovacInfinum Android Talks #17 - Developing an Android library  by Dino Kovac
Infinum Android Talks #17 - Developing an Android library by Dino Kovac
 

Recently uploaded

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 

Recently uploaded (20)

call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 

iOS Zagreb Meetup #02 - rxswift

  • 2. Problem ! Kognitivna kompleksnost sustava ! Stanje (kompleksnost, cachevi) ! Višedretvenost (Multithreading) ! Upravljanje resursima ! Oporavak od grešaka 2
  • 3. Kako rješiti ovaj problem ! https://www.youtube.com/watch?v=MseMobwg_mo
 Bruce Lee: Right. Right. You see, actually, I do not teach, you know, Karate, because I do not believe in styles anymore. I mean I do not believe that there is such thing as, like, a Chinese way of fighting or a Japanese way of fighting...or whatever way of fighting, because unless a human being has three arms and four legs, there can be no different form of fighting. But, basically, we only have two hands and two feet. So styles tend to, not only separate man because they have their own doctrines and the doctrine became the gospel truth that you cannot change! But, if you do not have styles, if you just say, "here I am as a human being, how can I express myself totally and completely?" ...now that way, you won't create a style because style is a crystallization. That way is a process of continuing growth. ! Problem je univerzalan, zato i rješenje treba biti dovoljno općenito za sve platforme i okruženje 3
  • 6. Rx ! matematička abstrakcija (monad) ! kompozicija, kompozicija, kompozicija … ! Microsoft Research - Erik Meijer ! poligotna implementacija (Swift, Java, Js, .NET, Clojure, Kotlin) ! Martin Fowler - observer pattern? no :( 6
  • 7. Rx BASH (datoteka program.sh) ! git diff | grep bug | less ! ./program.sh RxSwift ! gitDiff() >- grep(“bug") >- less ! >- subscribeNext … 7
  • 8. RxSwift let a = Variable(1) let b = Variable(2) let c: /* Observable<String> */ = combineLatest(a, b) { $0 + $1 } >- filter { $0 >= 0 } >- map { "($0) is positive" } c >- subscribeNext { println($0) } // prints: 3 is positive
 …
 a.next(4) // prints: 6 is positive b.next(-8) // doesn't print anything a.next(9) // prints: 1 is positive 8
  • 9. RxSwift ! RxSwift je verzija Rx-a za Swift ! Istrazivanje + razvoj je trajao 7 mjesec weekenda :) ! Objavljen na GH sredinom 4. mjeseca (2015) ! ispiriran je originalnom verzijom Rx.NET koja je evoluirala proteklih 6 godina ! RxSwift je poprilično stabilan i spreman za produkcijsku upotrebu ! ~30k linija swift koda, 430 unit testova 9
  • 10. Kako početi koristiti ! postoje neke očite primjene ! throttling, autocomplete, image loader, NSFetchedResultsController, NSNotificationCenter, delegati ! nije sve ili ništa ! moguće je napisati samo dijelove aplikacije reaktivno, a ostatak imperativno ! tko će naučiti sve te operatore ! što ako nema nekog operatora 10
  • 11. Zamke ! za naprednije primjene bilo bi dobro imati dublje shvaćanje kako Rx radi ! obično imperativni način razmišljanja je velika prepreka ! savjet, prvo naučite Haskell :))) ! nije silver bullet 11
  • 12. Konkurencija • ReactiveCocoa • ReactKit • RxSwift - JSS • RxSwift - NM • DeLorean • PromiseKit • Bolts 12