ivanbruel / Reddit-MVVM-Benchmark
- четверг, 5 мая 2016 г. в 03:18:37
Swift
MVVM with FRP Benchmark project
This project is part of a benchmark between MVVM+FRP and MVC architectures in iOS app development.
This project serves as the MVVM with FRP benchmark project.
You can read more about it in Medium.
MVVM denotes the Model-View-ViewModel architectural pattern, where Model data is encapsulated in ViewModel objects and the View does a (sometimes two-way) binding with the ViewModel's Model representation.
MVC denotes the Model-View-Controller architectural pattern, where the Controller operates the Model and the View represents the Model state.
For this particular benchmark we're going to create a simple Reddit application using their JSON API.
This application will try to cover most of the concerns that iOS developers actually have nowadays (e.g. asynchronous network calls, JSON parsing, image loading, collection/table views, storyboarding, user authentication, etc)
The application will be developed twice, once with an MVC architecture and again in MVVM.
When both application arquitectures are developed, some metrics will be measured, including:
Afterwards we will reflect upon results, and try to understand on which cases one of them trumps the other.
In order to minimize development time, a few dependencies will be used:
RxSwift, RxCocoa, RxOptional, Cell-Rx and NSObject+Rx will only be used on the MVVM+FRP project as they are the basis for FRP usage in iOS (in this particular case Swift).
This project will try to follow the GitHub Swift Styleguide in every way possible.
In order to enforce this, the project will also have a Swiftlint build phase to run the linter everytime the app is built.
Variable naming conventions will be ignored whenever a RxSwift-based variable is created (as the naming convention of the library is to start it with rx_ (e.g. rx_contentOffset
).
The project will follow this folder structure whenever applicable:
Reddit
├── App
│ └── AppDelegate
├── Enums
├── Extensions
├── Externals
├── Globals
├── Helpers
├── Models
├── Networking
├── Protocols
├── Resources
│ ├── LaunchScreen.storyboard
│ ├── Localizable.strings
│ └── Info.plist
├── Structs
├── ViewControllers
│ ├── Onboarding
│ │ └── Onboarding.storyboard
│ └── Main
│ └── Main.storyboard
├── ViewModels
└── Views
In order to enforce it to the filesystem we'll also be using Synx to keep the folder structures clean and mirroring the project structure.
We will be using Travis alongside Fastlane to perform continuous integration both by unit testing and deploying to Fabric or iTunes Connect later on.
Should anyone want to contribute to this long-term benchmark, feel free to do pull requests, open up issues and even join me on Twitter to discuss the architecture.