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

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 

Recently uploaded (20)

WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%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
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
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
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 

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