Skip to content

Bajocode/exploring-modern-ios-architectures

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exploring Modern iOS Architectures

Screenshots of the app

Project

In this project I'm structuring my knowledge about modern architectural patterns, showcasing the main features through a simple Movie app. The app makes use of the Tmdb API which requires an API key. However, static JSON files are also included for quick usage.

Setup

Static JSON
  1. In Xcode, choose a target / architecture
  2. Build and run!
Tmdb requests
  1. Request an API key 🔑
  2. Insert your key in TmdbAPIKey.plist located at the root of /Architectures
  3. In Xcode, choose a target / architecture
  4. Build and run!

Architectural Questions

As I work through the architectures I will experiment with different setups while keeping the core principles of the architectures in mind. The project is designed with code readability and learning in mind, to use them in production may require performance optimisations or other changes. Some architectural aspects to consider:

🔹 Orthogonality: responsibilities, distribution, coupling etc.

🔹 Ease of use: how easy is it to set up and implement?

🔹 Testability: is it easy and convenient to test?


MVC

MVC

Structure
  • Model
    • Conceptual domain model, representing real state content
    • Data layer objects, business logic (stores, managers)
  • View
    • Cells, UIView objects and subclasses
    • Send actions to Controller
  • Controller
    • Mediator between View and Model
    • Delegate and datasource of almost everything
    • Dispatching and canceling network requests
    • Manages View lifecycle (tightly coupled)

MVVM

MVC

Structure
  • Model
    • Conceptual domain model, representing real state content
  • View
    • Structure, layout, and appearance of what a user sees on the screen (UIViewControllers, cells, UIViews)
    • Updates it’s state from the ViewModel by setting up bindings
    • Forwards events to ViewModel
  • ViewModel
    • An abstraction of the view exposing public properties and commands
    • UIKit independent representation of the View
  • Binder
    • A (reactive) databinding technology is key to the pattern. However, this simplistic app example achieves binding through callbacks.

MVP

MVC

Structure
  • Model
    • Conceptual domain model, representing real state content
  • View
    • Passive UIViewControllers, cells, UIViews
    • May not know about Model or execute presentations
    • Delegates user interactions to the presenter
  • Presenter
    • Acts upon the model and the view
    • Contains the logic to handle user interactions
    • Retrieves data from the Model and formats it for display in the View

VIPER

MVC

Structure
  • View
    • Displays what it is told to by the Presenter and relays user input back to the Presenter
  • Interactor
    • Contains business logic as specified by a use case
    • The work done in an Interactor should be independent of any UI
  • Presenter
    • Contains View logic for preparing content for display (received from Interactor)
    • Reacts to user inputs with data from Interactor
  • Entity
    • Conceptual domain model, representing real state content
    • Only manipulated by the Interactor
  • Routing
    • Contains navigation logic for describing which screens are shown in which order
    • Routing is shared between the Presenter and Wireframe
    • Wireframe handles navigation transition animations

References

About

📐 A movie app experiment showcasing modern architectural iOS patterns

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages