SlideShare a Scribd company logo
출처 https://github.com/freak4pc/rxswift-to-combine-cheatsheet
let ps = PublishSubject<Int>()
let d = ps
.map { $0 * 10 }
.subscribe(onNext: {
print($0)
})
ps.onNext(1)
ps.onNext(2)
ps.onNext(3)
ps.onCompleted()
let ps = PassthroughSubject<Int, Error>()
let c = ps
.map { $0 * 10 }
.sink { print($0) }
ps.send(1)
ps.send(2)
ps.send(3)
ps.send(completion: .finished)
let ps = PublishSubject<Int>()
let d = ps
.map { $0 * 10 }
.subscribe(onNext: {
print($0)
})
ps.onNext(1)
ps.onNext(2)
ps.onNext(3)
ps.onCompleted()
let ps = PassthroughSubject<Int, Error>()
let c = ps
.map { $0 * 10 }
.sink { print($0) }
ps.send(1)
ps.send(2)
ps.send(3)
ps.send(completion: .finished)
let ps = PublishSubject<Int>()
let d = ps
.map { $0 * 10 }
.subscribe(onNext: {
print($0)
})
ps.onNext(1)
ps.onNext(2)
ps.onNext(3)
ps.onCompleted()
let ps = PassthroughSubject<Int, Error>()
let c = ps
.map { $0 * 10 }
.sink { print($0) }
ps.send(1)
ps.send(2)
ps.send(3)
ps.send(completion: .finished)
let ps = PublishSubject<Int>()
let d = ps
.map { $0 * 10 }
.subscribe(onNext: {
print($0)
})
ps.onNext(1)
ps.onNext(2)
ps.onNext(3)
ps.onCompleted()
let ps = PassthroughSubject<Int, Error>()
let c = ps
.map { $0 * 10 }
.sink { print($0) }
ps.send(1)
ps.send(2)
ps.send(3)
ps.send(completion: .finished)
let bs
= BehaviorSubject<Int>(value: 555)
let diposable = bs
.subscribe ( onNext: {
print($0)
})
Observable.just(486)
.bind(to: bs)
let cv
= CurrentValueSubject<Int, Never>(555)
let cancellable = currentValue
.sink {
print($0)
}
Just(777)
.subscribe(cv)
let bs
= BehaviorSubject<Int>(value: 555)
let diposable = bs
.subscribe ( onNext: {
print($0)
})
Observable.just(486)
.bind(to: bs)
let cv
= CurrentValueSubject<Int, Never>(555)
let cancellable = currentValue
.sink {
print($0)
}
Just(777)
.subscribe(cv)
let bs
= BehaviorSubject<Int>(value: 555)
let diposable = bs
.subscribe ( onNext: {
print($0)
})
Observable.just(486)
.bind(to: bs)
let cv
= CurrentValueSubject<Int, Never>(555)
let cancellable = currentValue
.sink {
print($0)
}
Just(777)
.subscribe(cv)
let bs
= BehaviorSubject<Int>(value: 555)
let diposable = bs
.subscribe ( onNext: {
print($0)
})
Observable.just(486)
.bind(to: bs)
let cv
= CurrentValueSubject<Int, Never>(555)
let cancellable = currentValue
.sink {
print($0)
}
Just(486)
.subscribe(cv)
let disposeBag = DisposeBag()
Observable.just(111)
.subscribe(onNext: { print($0) })
.disposed(by: disposeBag)
var cancellables = [Cancellable]()
let cancellable = Just(33)
.sink{ print($0) }
cancellables.append(cancellabel)
let disposeBag = DisposeBag()
Observable.just(111)
.subscribe(onNext: { print($0) })
.disposed(by: disposeBag)
var cancellables = [Cancellable]()
let cancellable = Just(33)
.sink{ print($0) }
cancellables.append(cancellabel)
var cancellables = [Cancellable]()
cancellables.append(
Just(1)
.handleEvents(receiveOutput: { _ in
print(Thread.isMainThread)
})
.receive(on: DispatchQueue.global())
.handleEvents(receiveOutput: { _ in
print(Thread.isMainThread)
})
.subscribe(on: DispatchQueue.main)
.handleEvents(receiveOutput: { _ in
print(Thread.isMainThread)
})
.sink { value in
print(Thread.isMainThread)
}
)
let disposeBag = DisposeBag()
Observable.just(1)
.do(onNext: { _ in
print(Thread.isMainThread)
})
.observeOn(ConcurrentDispatchQueueScheduler(
qos: .background))
.do(onNext: { _ in
print(Thread.isMainThread)
})
.subscribeOn(MainScheduler.instance)
.do(onNext: { _ in
print(Thread.isMainThread)
})
.subscribe(onNext: { _ in
print(Thread.isMainThread)
})
.disposed(by: disposeBag)
Combine vs RxSwift
Combine vs RxSwift
Combine vs RxSwift

More Related Content

What's hot

Go for the paranoid network programmer
Go for the paranoid network programmerGo for the paranoid network programmer
Go for the paranoid network programmer
Eleanor McHugh
 
Cis 216 – shell scripting
Cis 216 – shell scriptingCis 216 – shell scripting
Cis 216 – shell scripting
Dan Morrill
 
Process monitoring in UNIX shell scripting
Process monitoring in UNIX shell scriptingProcess monitoring in UNIX shell scripting
Process monitoring in UNIX shell scripting
Dan Morrill
 
Clojure入門
Clojure入門Clojure入門
Clojure入門
Naoyuki Kakuda
 
Crack.ba
Crack.baCrack.ba
Crack.ba
Yance Iyai
 
JavaForum Nord 2021: Java to Go - Google Go für Java-Entwickler
JavaForum Nord 2021: Java to Go - Google Go für Java-EntwicklerJavaForum Nord 2021: Java to Go - Google Go für Java-Entwickler
JavaForum Nord 2021: Java to Go - Google Go für Java-Entwickler
Jan Stamer
 
Sol9
Sol9Sol9
Tugas Program C++
Tugas Program C++Tugas Program C++
Tugas Program C++
Reynes E. Tekay
 
betterCode() Go: Einstieg in Go, Standard-Library und Ökosystem
betterCode() Go: Einstieg in Go, Standard-Library und ÖkosystembetterCode() Go: Einstieg in Go, Standard-Library und Ökosystem
betterCode() Go: Einstieg in Go, Standard-Library und Ökosystem
Jan Stamer
 
Introducing to Asynchronous Programming
Introducing to Asynchronous  ProgrammingIntroducing to Asynchronous  Programming
Introducing to Asynchronous Programming
Александр Федоров
 
Share test
Share testShare test
Share test
Anton Stuk
 
gemdiff
gemdiffgemdiff
gemdiff
teeparham
 
entwickler.de Go Day: Go Web Development 101
entwickler.de Go Day: Go Web Development 101entwickler.de Go Day: Go Web Development 101
entwickler.de Go Day: Go Web Development 101
Jan Stamer
 
DevOpsCon 2021: Go Web Development 101
DevOpsCon 2021: Go Web Development 101DevOpsCon 2021: Go Web Development 101
DevOpsCon 2021: Go Web Development 101
Jan Stamer
 
Coding with Vim
Coding with VimCoding with Vim
Coding with Vim
Enzo Wang
 
Cyclone + Eventsource (realtime push-сообщения)
Cyclone + Eventsource (realtime push-сообщения)Cyclone + Eventsource (realtime push-сообщения)
Cyclone + Eventsource (realtime push-сообщения)MoscowDjango
 

What's hot (20)

Vcs28
Vcs28Vcs28
Vcs28
 
Go for the paranoid network programmer
Go for the paranoid network programmerGo for the paranoid network programmer
Go for the paranoid network programmer
 
Cis 216 – shell scripting
Cis 216 – shell scriptingCis 216 – shell scripting
Cis 216 – shell scripting
 
Process monitoring in UNIX shell scripting
Process monitoring in UNIX shell scriptingProcess monitoring in UNIX shell scripting
Process monitoring in UNIX shell scripting
 
Clojure入門
Clojure入門Clojure入門
Clojure入門
 
Yg byev2e
Yg byev2eYg byev2e
Yg byev2e
 
Unix prog
Unix progUnix prog
Unix prog
 
Crack.ba
Crack.baCrack.ba
Crack.ba
 
JavaForum Nord 2021: Java to Go - Google Go für Java-Entwickler
JavaForum Nord 2021: Java to Go - Google Go für Java-EntwicklerJavaForum Nord 2021: Java to Go - Google Go für Java-Entwickler
JavaForum Nord 2021: Java to Go - Google Go für Java-Entwickler
 
Sol9
Sol9Sol9
Sol9
 
Tugas Program C++
Tugas Program C++Tugas Program C++
Tugas Program C++
 
betterCode() Go: Einstieg in Go, Standard-Library und Ökosystem
betterCode() Go: Einstieg in Go, Standard-Library und ÖkosystembetterCode() Go: Einstieg in Go, Standard-Library und Ökosystem
betterCode() Go: Einstieg in Go, Standard-Library und Ökosystem
 
Introducing to Asynchronous Programming
Introducing to Asynchronous  ProgrammingIntroducing to Asynchronous  Programming
Introducing to Asynchronous Programming
 
Share test
Share testShare test
Share test
 
gemdiff
gemdiffgemdiff
gemdiff
 
entwickler.de Go Day: Go Web Development 101
entwickler.de Go Day: Go Web Development 101entwickler.de Go Day: Go Web Development 101
entwickler.de Go Day: Go Web Development 101
 
Unix 5 en
Unix 5 enUnix 5 en
Unix 5 en
 
DevOpsCon 2021: Go Web Development 101
DevOpsCon 2021: Go Web Development 101DevOpsCon 2021: Go Web Development 101
DevOpsCon 2021: Go Web Development 101
 
Coding with Vim
Coding with VimCoding with Vim
Coding with Vim
 
Cyclone + Eventsource (realtime push-сообщения)
Cyclone + Eventsource (realtime push-сообщения)Cyclone + Eventsource (realtime push-сообщения)
Cyclone + Eventsource (realtime push-сообщения)
 

Similar to Combine vs RxSwift

20180310 functional programming
20180310 functional programming20180310 functional programming
20180310 functional programming
Chiwon Song
 
Oh Composable World!
Oh Composable World!Oh Composable World!
Oh Composable World!
Brian Lonsdorf
 
C++ TUTORIAL 7
C++ TUTORIAL 7C++ TUTORIAL 7
C++ TUTORIAL 7
Farhan Ab Rahman
 
Intro to OTP in Elixir
Intro to OTP in ElixirIntro to OTP in Elixir
Intro to OTP in Elixir
Jesse Anderson
 
D-Talk: What's awesome about Ruby 2.x and Rails 4
D-Talk: What's awesome about Ruby 2.x and Rails 4D-Talk: What's awesome about Ruby 2.x and Rails 4
D-Talk: What's awesome about Ruby 2.x and Rails 4
Jan Berdajs
 
Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014
Baruch Sadogursky
 
Basic Calculus in R.
Basic Calculus in R. Basic Calculus in R.
Basic Calculus in R.
Dr. Volkan OBAN
 
Stefan Kanev: Clojure, ClojureScript and Why They're Awesome at I T.A.K.E. Un...
Stefan Kanev: Clojure, ClojureScript and Why They're Awesome at I T.A.K.E. Un...Stefan Kanev: Clojure, ClojureScript and Why They're Awesome at I T.A.K.E. Un...
Stefan Kanev: Clojure, ClojureScript and Why They're Awesome at I T.A.K.E. Un...
Mozaic Works
 
Groovy puzzlers jug-moscow-part 2
Groovy puzzlers jug-moscow-part 2Groovy puzzlers jug-moscow-part 2
Groovy puzzlers jug-moscow-part 2
Evgeny Borisov
 
Advanced Data Visualization in R- Somes Examples.
Advanced Data Visualization in R- Somes Examples.Advanced Data Visualization in R- Somes Examples.
Advanced Data Visualization in R- Somes Examples.
Dr. Volkan OBAN
 
JavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovyJavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovyYasuharu Nakano
 
Go: It's Not Just For Google
Go: It's Not Just For GoogleGo: It's Not Just For Google
Go: It's Not Just For Google
Eleanor McHugh
 
Артём Акуляков - F# for Data Analysis
Артём Акуляков - F# for Data AnalysisАртём Акуляков - F# for Data Analysis
Артём Акуляков - F# for Data Analysis
SpbDotNet Community
 
Functional JS for everyone - 4Developers
Functional JS for everyone - 4DevelopersFunctional JS for everyone - 4Developers
Functional JS for everyone - 4Developers
Bartek Witczak
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with ClojureDmitry Buzdin
 
Generics and Inference
Generics and InferenceGenerics and Inference
Generics and Inference
Richard Fox
 
ZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made SimpleZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made Simple
Ian Barber
 
Monadologie
MonadologieMonadologie
Monadologie
league
 
Pop3ck sh
Pop3ck shPop3ck sh
Pop3ck sh
Ben Pope
 
Blocks+gcd入門
Blocks+gcd入門Blocks+gcd入門
Blocks+gcd入門
領一 和泉田
 

Similar to Combine vs RxSwift (20)

20180310 functional programming
20180310 functional programming20180310 functional programming
20180310 functional programming
 
Oh Composable World!
Oh Composable World!Oh Composable World!
Oh Composable World!
 
C++ TUTORIAL 7
C++ TUTORIAL 7C++ TUTORIAL 7
C++ TUTORIAL 7
 
Intro to OTP in Elixir
Intro to OTP in ElixirIntro to OTP in Elixir
Intro to OTP in Elixir
 
D-Talk: What's awesome about Ruby 2.x and Rails 4
D-Talk: What's awesome about Ruby 2.x and Rails 4D-Talk: What's awesome about Ruby 2.x and Rails 4
D-Talk: What's awesome about Ruby 2.x and Rails 4
 
Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014
 
Basic Calculus in R.
Basic Calculus in R. Basic Calculus in R.
Basic Calculus in R.
 
Stefan Kanev: Clojure, ClojureScript and Why They're Awesome at I T.A.K.E. Un...
Stefan Kanev: Clojure, ClojureScript and Why They're Awesome at I T.A.K.E. Un...Stefan Kanev: Clojure, ClojureScript and Why They're Awesome at I T.A.K.E. Un...
Stefan Kanev: Clojure, ClojureScript and Why They're Awesome at I T.A.K.E. Un...
 
Groovy puzzlers jug-moscow-part 2
Groovy puzzlers jug-moscow-part 2Groovy puzzlers jug-moscow-part 2
Groovy puzzlers jug-moscow-part 2
 
Advanced Data Visualization in R- Somes Examples.
Advanced Data Visualization in R- Somes Examples.Advanced Data Visualization in R- Somes Examples.
Advanced Data Visualization in R- Somes Examples.
 
JavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovyJavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovy
 
Go: It's Not Just For Google
Go: It's Not Just For GoogleGo: It's Not Just For Google
Go: It's Not Just For Google
 
Артём Акуляков - F# for Data Analysis
Артём Акуляков - F# for Data AnalysisАртём Акуляков - F# for Data Analysis
Артём Акуляков - F# for Data Analysis
 
Functional JS for everyone - 4Developers
Functional JS for everyone - 4DevelopersFunctional JS for everyone - 4Developers
Functional JS for everyone - 4Developers
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
Generics and Inference
Generics and InferenceGenerics and Inference
Generics and Inference
 
ZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made SimpleZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made Simple
 
Monadologie
MonadologieMonadologie
Monadologie
 
Pop3ck sh
Pop3ck shPop3ck sh
Pop3ck sh
 
Blocks+gcd入門
Blocks+gcd入門Blocks+gcd入門
Blocks+gcd入門
 

Recently uploaded

Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
ViralQR
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 

Recently uploaded (20)

Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 

Combine vs RxSwift

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21. let ps = PublishSubject<Int>() let d = ps .map { $0 * 10 } .subscribe(onNext: { print($0) }) ps.onNext(1) ps.onNext(2) ps.onNext(3) ps.onCompleted() let ps = PassthroughSubject<Int, Error>() let c = ps .map { $0 * 10 } .sink { print($0) } ps.send(1) ps.send(2) ps.send(3) ps.send(completion: .finished)
  • 22. let ps = PublishSubject<Int>() let d = ps .map { $0 * 10 } .subscribe(onNext: { print($0) }) ps.onNext(1) ps.onNext(2) ps.onNext(3) ps.onCompleted() let ps = PassthroughSubject<Int, Error>() let c = ps .map { $0 * 10 } .sink { print($0) } ps.send(1) ps.send(2) ps.send(3) ps.send(completion: .finished)
  • 23. let ps = PublishSubject<Int>() let d = ps .map { $0 * 10 } .subscribe(onNext: { print($0) }) ps.onNext(1) ps.onNext(2) ps.onNext(3) ps.onCompleted() let ps = PassthroughSubject<Int, Error>() let c = ps .map { $0 * 10 } .sink { print($0) } ps.send(1) ps.send(2) ps.send(3) ps.send(completion: .finished)
  • 24. let ps = PublishSubject<Int>() let d = ps .map { $0 * 10 } .subscribe(onNext: { print($0) }) ps.onNext(1) ps.onNext(2) ps.onNext(3) ps.onCompleted() let ps = PassthroughSubject<Int, Error>() let c = ps .map { $0 * 10 } .sink { print($0) } ps.send(1) ps.send(2) ps.send(3) ps.send(completion: .finished)
  • 25.
  • 26. let bs = BehaviorSubject<Int>(value: 555) let diposable = bs .subscribe ( onNext: { print($0) }) Observable.just(486) .bind(to: bs) let cv = CurrentValueSubject<Int, Never>(555) let cancellable = currentValue .sink { print($0) } Just(777) .subscribe(cv)
  • 27. let bs = BehaviorSubject<Int>(value: 555) let diposable = bs .subscribe ( onNext: { print($0) }) Observable.just(486) .bind(to: bs) let cv = CurrentValueSubject<Int, Never>(555) let cancellable = currentValue .sink { print($0) } Just(777) .subscribe(cv)
  • 28. let bs = BehaviorSubject<Int>(value: 555) let diposable = bs .subscribe ( onNext: { print($0) }) Observable.just(486) .bind(to: bs) let cv = CurrentValueSubject<Int, Never>(555) let cancellable = currentValue .sink { print($0) } Just(777) .subscribe(cv)
  • 29. let bs = BehaviorSubject<Int>(value: 555) let diposable = bs .subscribe ( onNext: { print($0) }) Observable.just(486) .bind(to: bs) let cv = CurrentValueSubject<Int, Never>(555) let cancellable = currentValue .sink { print($0) } Just(486) .subscribe(cv)
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41. let disposeBag = DisposeBag() Observable.just(111) .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) var cancellables = [Cancellable]() let cancellable = Just(33) .sink{ print($0) } cancellables.append(cancellabel)
  • 42. let disposeBag = DisposeBag() Observable.just(111) .subscribe(onNext: { print($0) }) .disposed(by: disposeBag) var cancellables = [Cancellable]() let cancellable = Just(33) .sink{ print($0) } cancellables.append(cancellabel)
  • 43.
  • 44.
  • 45.
  • 46. var cancellables = [Cancellable]() cancellables.append( Just(1) .handleEvents(receiveOutput: { _ in print(Thread.isMainThread) }) .receive(on: DispatchQueue.global()) .handleEvents(receiveOutput: { _ in print(Thread.isMainThread) }) .subscribe(on: DispatchQueue.main) .handleEvents(receiveOutput: { _ in print(Thread.isMainThread) }) .sink { value in print(Thread.isMainThread) } ) let disposeBag = DisposeBag() Observable.just(1) .do(onNext: { _ in print(Thread.isMainThread) }) .observeOn(ConcurrentDispatchQueueScheduler( qos: .background)) .do(onNext: { _ in print(Thread.isMainThread) }) .subscribeOn(MainScheduler.instance) .do(onNext: { _ in print(Thread.isMainThread) }) .subscribe(onNext: { _ in print(Thread.isMainThread) }) .disposed(by: disposeBag)