Skip to content

SwiftCleanCode/Archit-iOS

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intelygenz iOS Architecture

Twitter Build Status License codebeat badge

This repository contains an iOS architecture documentation with a sample application that uses OMDb API and implements the Archit architecture.

🔨 Xcode Configuration

  • You should enable Xcode Text Editing options:

    1. Line numbers. (Specify a line to a mate or search for a crash)
    2. Code folding ribbon. (Optional)
    3. Page guide at column: 140 (No line should exceed it, so we will all read the same code)
    4. Including whitespace-only lines. (Lighter files)

    Xcode Text Editing

🔧 Project Installation

$ brew tap yonaskolb/XcodeGen https://github.com/yonaskolb/XcodeGen.git
$ brew install XcodeGen
$ git clone https://github.com/intelygenz/Archit-iOS.git
$ cd Archit-iOS
$ xcodegen

🔧 Project Configuration

  • Configure the breakpoints:

    In the Breakpoint navigator, create an "Exception Breakpoint...":

    Exception Breakpoint

    Also create a "Symbolic Breakpoint..." with "UIViewAlertForUnsatisfiableConstraints" as "Symbol":

    Unsatisfiable Constraints Breakpoint

🤓 Usage

AppManager

We delegate all responsibilities of the AppDelegate to an AppManager under our control, testable and that will be in charge of initializing all third-party frameworks that need initialization in the didFinishLaunching for example.

In addition, if we need location services, notifications, etc. We will create independent managers for each of them, and only their implementation will have access to the specific frameworks.

AppManager

VCI (ViewController Controller Interactor)

We will create base view controllers for each of the native view controllers we need, all the application view controllers will inherit from these base view controllers.

Each view controller will be injected with the corresponding controller depending on whether we are developing, testing or in production, so we can mock what we want.

Each controller will have an interactor who will be in charge of calling the asynchronous core framework tasks, generating a Kommand and passing it to the controller for execution and response handling.

VCI (ViewController Controller Interactor)

Core Framework

Only the StorageManager knows the existence of the persistence framework that is used.

There will be intermediate StorageModels to map/parse the application model and store/update/fetch them in the database.

Only the HTTPClient knows the existence of the networking framework that is used.

There will be intermediate NetworkModels to map/parse the application model and get/post/put them to the network.

The service has tasks for each network API call related with the same context (application model, use case, web service).

Core Framework

CocoaPods

Every networking layer must be implemented around Net protocol.

By default, we'll use NetClient for networking.

We can use Kommander to manage asynchronous processes, but always outside the Core Framework.

To instantiate or reuse Storyboards, ViewControllers, Views, UITableViewCells or UICollectionViewCells, you must use Reusable.

To handle Dates and Timezones, we could use SwiftDate.

We MUST use ATTD with HonestCode, therefore we'll need Cucumberish.

In order to use user location, we will use IGZLocation.

When we need to modify Auto Layout programmatically, we could use SnapKit.

For async image loading we could use Kingfisher.

To use NotificationCenter, SwiftNotificationCenter is recommended.

To display the progress of an ongoing task, you could use SVProgressHUD or SkeletonView.

To securely store data, we use Valet.

As logging library, we love XCGLogger.

❤️ Etc.

  • Contributions are very welcome.
  • Attribution is appreciated (let's spread the word!), but not mandatory.

👨🏻‍💻 Authors

alexruperez, alejandro.ruperez@intelygenz.com

👮🏻 License

Archit is available under the MIT license. See the LICENSE file for more info.

About

Intelygenz iOS Architecture

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 79.0%
  • Ruby 15.1%
  • Shell 4.6%
  • Objective-C 1.3%