mercredi 23 août 2017

iOS Swift design for integrating n/w layer

I have simple ListView that needs to display the records from the network layer. (first screen of the application)

I need to get some opinion as to which will be correct flow so that I can make the unit test cases easily. (No VIPER architecture)

NetworkMgr makes the network calls and create Model objects.

These Model objects needs to be populated in ListTableView.

I have a completion handler method to call the network request which give the model objects.

func getData() {
 dataMgr.requestData(url:  "String") { (EmployeesArray, error) in

        //  print(error)
    }
}

Now my question is which point should initiate this method to fetch data. - from the controller like viewdidload - or from some Singleton class

===

Your feedback will be very helpful.

Any hint or tutorial in right direction will be highly appreciable.

Aucun commentaire:

Enregistrer un commentaire