Master Detail iOS Application using swift 5.
Functionalities include:
- Refresh from service
- Display all/favorites
- Delete All
- Display as not viewed/favorite
- Toggle favorite
- Swipe to remove
- REST Client
- Unit Tests
Donwload manually, or clone repository:
git clone https://github.com/huffmann/clean-swift-vip && cd clean-swift-vip
In repository folder, Install Alamofire via cocoapods command:
pod install
And finally to open project, open .xcworkspace file
Clean swift is an Architectural approach that ensures code is structured in a clear and easy to undertand manner (see screaming architecture), and it also enforces SOLID principles. The main objects of this design are: View, Interactor, Presenter, Entity, Router and UseCase. In a Clean design, Data flows one way in a V-I-P Cycle:
View -> Interactor -> Presenter -> View
The View informs the Interactor of an event and binds data if required. (ie: did press search button)
The Interactor uses the received data to gather the necessary data via UseCase.
UseCases are where the business logic resides. Here is where the app call services, loads from repositories, etc.
After getting result from useCase, Interactor informs presenter about result with the gathered data.
Presenter formats this data to a ViewModel and sends it to View to consume.
ViewModel
This Object type, has the dataModel as well as the required properties for correct display, ie: icons, toggles, etc.
Protocol used for communication between view controllers: inform of events, send data.
labeled weak to avoid retain cycles.
All REST API service calls are managed via Alamofire, which is a robust, community driven, HTTP networking library written in Swift.
For service response data parsing, I used swift's Decodable protocol which is neatly integrated into Alamofire via responseDecodable
The web service class binds a Generic Decodable class which will be returned async via completion handler.
I will work on moving user interface to SwiftUI and Combine instead of Interface builder. And from there...
.-.
( (
`-'
. ,- To the Moon!
.'.
|o|
.'o'.
|.-.|
' '
( )
)
( )