TDViperKit 0.2

TDViperKit 0.2

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Dec 2016
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Vlad Alexa, James Shaw, Ben Baggley.



  • By
  • Josh Campion

ViperKit

Clean Architecture for iOS.

Requirements

  • iOS 8.0+
  • Xcode 7.1+

Communication

  • If you have found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.
  • If you’d like to ask a general question, email .

Installation

Features

At The Distance, we have multiple projects with common functionality. Shared implementations ensure these features are developed concisely and remain bug free. TheDistanceKit is the overarching project containing this reusable code.

ViperKit is a framework to make writing apps using a clean architecture easier.

What is Viper?

First developed by Mobile Mutual and explained in further detail on objc.io, Viper is an application of Clean Architecture to iOS apps.

These articles are very theory based and explain the overarching concepts well. When I first attempted to apply this architecture to a large scale commercial app, I ran into many undefined or inconsistent applications of the theory in the articles and demo code providied.

ViperKit contains protocols and default implementations for writing an iOS app using the 'Viper’ architecture. With a much stricter definition of the roles and responsibilities of each object in the architecture.

The key benefits of this stricter interpretation of the architecture are:

  1. Clear modularity of components of the app
  2. Testability of UIViewController functionality through separation of logic and view-model elements.
  3. Smaller files, in particular, UIViewControllers
  4. Easier refactoring or updating of individual app components
  5. Easier collaboration as protocols allow different parts of the same app to be developed simultaneously.
Tell me more!

[TBD] is a series of blog posts explaining how to apply this architecture to a wide variety of situations in much more detail.

What’s in ViperKit?
  • Standard Protocols: Protocols are defined for each type of Viper object allowing for consistent assignment of roles between components in an app.
  • List Implementation: Specific protocols for lists are provided. Clean API for populating a list in a well defined manner is given by the ListDataSource protocol. A CoreData backed implementation and an object backed implementation are given.
  • CoreData & Entity Model Objects: Viper Entities represent pure data in an app. MappedFetchedResultsController and the CoreDataMapper protocol are provided to convert between NSManagedObjects and pure data, allowing data to be cleanly passed around the application without the need to consider the complexities associated with NSManagedObjects.