Comments (4)
In my opinion subscribeOn
does not make any difference here as URLSession
uses it's own internal queue to process response, and creating network request is not that performance impact operation ¯_(ツ)_/¯
from cleanarchitecturerxswift.
Hi, @lizhiquan! Glad that it helps :)
With subscribeOn
you can specify on which scheduler (thread, queue) you want subscription to happened. And sometimes it's very important, for example in case of core data all operations need to be performed inside of the context.execute { }
block. That's why I've used ContextScheduler
there. In case of Realm
I did not want all operations to be performed on the main thread as well
With observeOn
you can specify on which scheduler (thread, queue) you want to observe values emitted by the observable sequence. And and it's very important when it comes to UI bindings because all UI related updates must be on the Main
queue
from cleanarchitecturerxswift.
Hi, @sergdort!
I understand the difference between two operators, but I wonder why don't you use subscribeOn in your Network requests. As I know, the code after observeOn
will run on the scheduler you specified.
So in this case, network request will run on current scheduler (maybe main scheduler) and the mapper to json will run on concurrent scheduler. If we use subscribeOn
, we will make both api request and json mapper stuff all run on concurrent scheduler, which is more appropriate.
from cleanarchitecturerxswift.
Thank you :)
from cleanarchitecturerxswift.
Related Issues (20)
- How to decode json other then using codable? HOT 4
- Any one can help me out? When i run the example project, it crashed "dyld: Library not loaded". HOT 8
- Why Post+Mapping.swift uses NSObject HOT 1
- save data list in realm HOT 1
- RxDataSources and CleanArchitecture
- Wrong Action when select "No" in Alert
- Generic UseCases and UseCaseProvider
- Communication with child view controller HOT 2
- Question around `do` and `Driver` for Input HOT 3
- How can I run your demo project on Xcode 10.1 & Swift 4.2 HOT 1
- You don't seem to understand Clean Architecture HOT 6
- crash on Xcode 11 when click Realm Tab HOT 2
- MVVM Isuue HOT 1
- Making use cases generic doesn't work with associatedtypes
- Multiple models for Repository in single UseCase. HOT 3
- Combine Version of ActivityIndicator and ErrorTacker HOT 1
- Maybe memory leaks
- Why use case containing rxSwift? HOT 1
- App crash when touched Realm tabbar HOT 1
- Handling Core Data To-Many relationships
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cleanarchitecturerxswift.