Skip to content

Master Detail App with REST client and several UI functionalities

Notifications You must be signed in to change notification settings

jf-gallo/clean-swift-vip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clean Master Detail iOS

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

Run instructions

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

Architecture details

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.

Delegate Pattern

Protocol used for communication between view controllers: inform of events, send data.

labeled weak to avoid retain cycles.

Web Services

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.

Future Enhancements

I will work on moving user interface to SwiftUI and Combine instead of Interface builder. And from there...

                     .-.
                    ( (
                     `-'



                .   ,- To the Moon!
               .'.
               |o|
              .'o'.
              |.-.|
              '   '
               ( )
                )
               ( )

About

Master Detail App with REST client and several UI functionalities

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published