iOS App Architecture with NSOperations

前端 未结 3 1337
天命终不由人
天命终不由人 2021-02-03 11:07

Two month ago I started to write a new iPhone Application and for this reason I created a generic RESTFul web service, which allows me to have a lot of these necessary features

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-03 11:59

    You have just described a very similar architecture that I'm using in a few of my apps :)

    I have my service manager layer returning a set of objects instantly and then returning an updated set after a while i.e.

    NSArray *stuff = [serviceManager getFriendsForUser:@"Bob"];
    

    and then, after the server has responded, an NSNotification is received that contains an updated list (of friends for Bob in this case).

    Apart from this tiny change, your architecture is the same!

    It is quite a lot of work to get it all set up but I think it's worth it in the long run as fixing bugs / extending the code is much easier.

提交回复
热议问题