Closed wangwangwar closed 7 years ago
A: I want to make the API requesting cleaner and more graceful. I want to make code testable (now there is no test).
A: I will try to wrap the API requesting in RAC signal form. I will try to add a VIEW MODEL layer to make the code testable.
A: API requesting.
A: Because I'm learning them - -. OK, fetching DATA from server, showing DATA on screen. Receiving CHANGING from human, syncing DATA back to server. As you can see, DATA and CHANGING is the core (Who's not - -). This is RAC's advantage: hacking DATA and responding to CHANGING. Data-driven APP handle data often. Data from MACHINE and from HUMAN are both random and sloppy, often. If we want to keep the APP robust, we must test with data, all kinds of data. MVVM add a View Model layer between the View/Controller and the Model, which make data handling easier and testable.
Class CodingNetAPIClient
wraps AFNetworking and provides the common requesting methods. Class Coding_NetAPIManager
(WTF class naming?) use CodingNetAPIClient
to do specific requests. It includes all API requesting methods.
Here I want to:
RACSignal
form (thanks CodaFi/AFNetworking-RACExtensions). Due to "Coding-iOS"'s brain-fuck "Vendor" library, I decide to do my very personal fork, which may conflicts with the official version. And I move the code from https://coding.net/u/wangwangwar/p/Coding-iOS/git to https://github.com/wangwangwar/Coding-iOS-Fork, just for using Github's fantastic issue and pull request manager!
Coding-iOS is the official iOS client for Coding.net.
Recently I'm learning ReactiveCocoa and reading some related projects(AshFurrow/C-41, jspahrsummers/GroceryList). I'm totally impressed by FRP's grace and MVVM's modularity. I decide to do some projects to verify my shallow understanding. Y not Coding-iOS?