Thank you for liking my article. :)
Yeah, for complicated operations, the logic should be moved outside the view model, separating the responsibilities.
You might want to check another article of mine (sorry they are on different platforms), it introduces a Controller as you mentioned, handling…
Thank you for your detailed comment and thank you for the suggestions :)
I’ve updated the code https://github.com/koromiko/Tutorial/commit/966277f7dad9585d5d25328443ac5c84762bcfd6 to fix the infinite issue. Base on your suggestion, I also updated code to explicitly call dataTask(with:completionHandler). So we don’t need to use NSURLReuqest anymore.
Hi, indeed, moving the business logic outside the view model is a good idea I’m used to creating a controller for handling the business logic. Check my new article https://flawlessapp.io/blog/advanced-mvvm-tableview-tutorial/ for further information!
It could be achieved by binding techniques such as RxSwift’s Observable or the Binding with Closure pattern in this article. Though the Model-ViewModel relation looks like an observer pattern in the diagram, it’s not necessarily to be. If you want to make the interface easier to be tested, I would recommend using a…
Hello, sorry for the late reply.
Could you provide the fastlane log for the failure build so that we can check the detailed cause of the failure?
But if I have to guess, my first thought is because of the changing of the working directory.
Hi, surely you can use a delegate pattern to handle the communication between ViewModel and View. The difference is that with closure, we don’t declare the ViewModel-to-View interface like what we do in the delegate pattern. The responsibility of binding is purely on the View and we don’t need to observe the properties in the ViewModel. On the other…