Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Functional Reactive
Programming avec RxSwift
Cocoaheads Strasbourg Mai 2017
Nicolas VERINAUD
Freelance
Formateur
Développeur iOS depuis
2011
Prog. Fonctionnelle (yay
F# !)
Qui suis-je ?
@nverinaud
≠ OOP
Composition > Héritage
Fonctions en paramètre
(closures)
Immuabilité
Functional
Programming
Réagir aux changements d’états
Délégation
Closures
Notifications (😨)
KVO (🤢)
Reactive Programming
Réagir aux changements d’états
Délégation [implicite]
Closures [implicite]
Notifications (😨) [implicite]
KVO (🤢) [implicit...
“Explicit is better than implicit.”
–The Zen of Python
Observable<T>
Une valeur qui change
au cours du temps.
Observable<T>
Push
≠
Pull (Sequence)
Observable<T>
protocol Observable<T>
{
func subscribe(_ observer: Observer<T>)
-> Disposable
}
Observable<T>
protocol Observer<T>
{
func onNext(_ element: T)
func onError(_ error: Error)
func onCompleted()
}
Observable<T>
Observable<A> -> Observable<B>
Observable<String> -> Observable<Bool>
Observable<T>
How ?
Observable<A> -> Observable<B>
Observable<String> -> Observable<Bool>
Observable<T>
Avec map !
Monad in disguise…psshh
Observable<A> -> Observable<B>
Observable<String> -> Observable<Bool>
Observable<T>
func map(_ transform: (A -> B)) ->
Obs...
Observable<T>
// strings: Observable<String>
let isEmpty = strings.map { $0.isEmpty }
Observable<T>
Demo !
RxSwift
ou
ReactiveCocoa
?
RxSwift
👍 Respectueux des interfaces Rx
originales
👎 Pas de typage pour Error
ReactiveCocoa
👍 Typage de Error
👍 Distinction Hot et Cold
👎 Concepts ≠ Rx (Signal)
One more thing…
“No Silver Bullet”
–Fred Brooks
“Reactive is dead, long
live tasteful composition
of side effects.”
–Erik Meijer
One Many
Sync T Sequence
Async Future<T> Observable<T>
Tasteful Side Effects
Tasteful Side Effects
Future<Option<Array<String>>>
Result<Observable<String>>
etc…
Tasteful Side Effects
Future<Option<Array<String>>>
Result<Observable<String>>
etc…
Soyez explicites !
Aller plus loin…
ReactiveX.io
IntroToRx.com
React 2014 : Erik Meijer - What
does it mean to be Reactive?
Merci !
@nverinaud
n.verinaud@gmail.com
nverinaud.com
Bibliographie
Kaa - http://www.abadinte.com/wp-content/
uploads/2014/09/Kaa-aie-confiance.jpg
Fred Brooks Wikipedia - http...
Functional Reactive Programming avec RxSwift
Functional Reactive Programming avec RxSwift
Functional Reactive Programming avec RxSwift
Upcoming SlideShare
Loading in …5
×

Functional Reactive Programming avec RxSwift

1,222 views

Published on

Slides de ma conférence donnée à Cocoaheads Strasbourg en mai 2017 sur la programmation fonctionnelle réactive en swift (avec la librairie RxSwift).

Retrouvez le code de la démo ici: https://github.com/nverinaud/prez-frp-cocoaheads-may-2017

Published in: Technology
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy &amp; Proven Way to Build Good Habits &amp; Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy &amp; Proven Way to Build Good Habits &amp; Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy &amp; Proven Way to Build Good Habits &amp; Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy &amp; Proven Way to Build Good Habits &amp; Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy &amp; Proven Way to Build Good Habits &amp; Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Functional Reactive Programming avec RxSwift

  1. 1. Functional Reactive Programming avec RxSwift Cocoaheads Strasbourg Mai 2017 Nicolas VERINAUD
  2. 2. Freelance Formateur Développeur iOS depuis 2011 Prog. Fonctionnelle (yay F# !) Qui suis-je ? @nverinaud
  3. 3. ≠ OOP Composition > Héritage Fonctions en paramètre (closures) Immuabilité Functional Programming
  4. 4. Réagir aux changements d’états Délégation Closures Notifications (😨) KVO (🤢) Reactive Programming
  5. 5. Réagir aux changements d’états Délégation [implicite] Closures [implicite] Notifications (😨) [implicite] KVO (🤢) [implicite] Reactive Programming
  6. 6. “Explicit is better than implicit.” –The Zen of Python
  7. 7. Observable<T>
  8. 8. Une valeur qui change au cours du temps. Observable<T>
  9. 9. Push ≠ Pull (Sequence) Observable<T>
  10. 10. protocol Observable<T> { func subscribe(_ observer: Observer<T>) -> Disposable } Observable<T>
  11. 11. protocol Observer<T> { func onNext(_ element: T) func onError(_ error: Error) func onCompleted() } Observable<T>
  12. 12. Observable<A> -> Observable<B> Observable<String> -> Observable<Bool> Observable<T> How ?
  13. 13. Observable<A> -> Observable<B> Observable<String> -> Observable<Bool> Observable<T> Avec map ! Monad in disguise…psshh
  14. 14. Observable<A> -> Observable<B> Observable<String> -> Observable<Bool> Observable<T> func map(_ transform: (A -> B)) -> Observable<B>
  15. 15. Observable<T> // strings: Observable<String> let isEmpty = strings.map { $0.isEmpty }
  16. 16. Observable<T> Demo !
  17. 17. RxSwift ou ReactiveCocoa ?
  18. 18. RxSwift 👍 Respectueux des interfaces Rx originales 👎 Pas de typage pour Error
  19. 19. ReactiveCocoa 👍 Typage de Error 👍 Distinction Hot et Cold 👎 Concepts ≠ Rx (Signal)
  20. 20. One more thing…
  21. 21. “No Silver Bullet” –Fred Brooks
  22. 22. “Reactive is dead, long live tasteful composition of side effects.” –Erik Meijer
  23. 23. One Many Sync T Sequence Async Future<T> Observable<T> Tasteful Side Effects
  24. 24. Tasteful Side Effects Future<Option<Array<String>>> Result<Observable<String>> etc…
  25. 25. Tasteful Side Effects Future<Option<Array<String>>> Result<Observable<String>> etc… Soyez explicites !
  26. 26. Aller plus loin… ReactiveX.io IntroToRx.com React 2014 : Erik Meijer - What does it mean to be Reactive?
  27. 27. Merci ! @nverinaud n.verinaud@gmail.com nverinaud.com
  28. 28. Bibliographie Kaa - http://www.abadinte.com/wp-content/ uploads/2014/09/Kaa-aie-confiance.jpg Fred Brooks Wikipedia - https:// fr.m.wikipedia.org/wiki/Frederick_Brooks Erik Meijer Wikipedia - https://en.wikipedia.org/ wiki/Erik_Meijer_%28computer_scientist%29 React 2014 : Erik Meijer - What does it mean to be Reactive? Meme Generator - memegenerator.net

×