跳至主要内容

博文

目前显示的是 九月, 2021的博文

MVVM(Model-View-ViewModel) with Swift application 3/3

 原文链接 This is the last post of creating an MVVM (Model-View-ViewModel) application with Swift series. In the  first  and  second  part, we went through the basic principles of MVVM, covered data binding pattern and also handled presenting errors to the user. At the end of the  second post , we were able to download and present friend data to the user using table view. This last post adds functionality to the application. We’ll create, update and delete users from the backend and we will also pass a ViewModel into View when we are updating friends information. As you might have guessed, we will continue to use the FriendService built in the first post:  Server-side Swift, how to set up a backend . You can either set up the backend at your localhost by following the instructions in the post, or you can use the service I have running on Heroku. For example to list all friends you should use HTTP-get with this URL:  http://friendservice.herokuapp.com/...