Best-practices to download data from server in SwiftUI

后端 未结 3 1734
失恋的感觉
失恋的感觉 2021-02-10 16:12

My question is a conceptual question.

I have the following code:

struct CategoriesList : View {

    @State pri         


        
3条回答
  •  北海茫月
    2021-02-10 16:28

    iOS developers don't seem to be as familiar to this idea as Mac OS developers, in Mac apps we split the controller layer into ViewController and ModelControllers, ViewControllers are responsible for synchronise between the views and the model, ModelControllers are responsible for managing archiving of the model etc, so SwiftUI does away with ViewControllers, but if you have network handling then thats where ModelControllers would be useful, they could handle the synchronising between you remote source and you model, this is how I am currently doing it in a sample application I am working, though I have been wondering if Combine could be used to replace that as well, that will be my next thing to experiment with.

提交回复
热议问题