Clean Start is a remix of the Clean Swift templates.
- Use one true brace style over the default templates Allman brace style.
- Use
guard
to return early in some places. - Use extensions to organize code into logical sections.
- Provide templates for apps that manage views in code.
- Provide default access levels for classes, methods, and properties.
To learn more about Clean Swift and the VIP cycle, read:
http://clean-swift.com/clean-swift-ios-architecture
There is a sample app available at:
https://github.com/Clean-Swift/CleanStore
Templates are shared from the repo and have to be managed manually. To install the Clean Start Swift Xcode templates clone or download this repo and then:
To install templates for storyboards and view code
$: make install_templates
To install templates for just storyboards
$: make install_storyboard_templates
To install templates for just view code
$: make install_viewcode_templates
To uninstall the Xcode templates, run:
$: make uninstall_templates
Add the pod to your Podfile
pod 'CleanStart', git: 'https://github.com/ajself/CleanStart.git'
Install the Clean Start pod
$: pod install
And the Clean Start pod includes only a single helpful file: ViewConfigurable.swift
.
It is important to first understand Clean Swift in general, then read the following to see how Clean Start differs.
View Controllers/Views are now organized into logical sections using extensions.
- Object lifecycle (instance specific methods such as initializers).
- View lifecycle (instance specific methods such as
viewDidLoad
). - Inputs, sectioned into use case specific areas. This is where you place your protocol conformance methods.
- View code only View configuration by conforming to
ViewConfigurable
.