Last active
April 19, 2017 11:54
-
-
Save fpg1503/4e416757f7fc6700fa1b5f9029592973 to your computer and use it in GitHub Desktop.
Cartography Boilerplate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cartography | |
final class <#Name#>View: UIView { | |
init() { | |
super.init(frame: .zero) | |
self.buildViews() | |
} | |
required init?(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) | |
self.buildViews() | |
} | |
private func buildViews() { | |
addSubviews() | |
formatViews() | |
addConstraintsToSubviews() | |
} | |
//TODO: Subviews constants | |
private func addSubviews() { | |
//TODO Add subviews | |
} | |
private func formatViews() { | |
//TODO: Format views | |
} | |
private func addConstraintsToSubviews() { | |
//TODO: Cartography Constraints | |
} | |
override func didMoveToSuperview() { | |
super.didMoveToSuperview() | |
guard let superview = superview else { | |
return | |
} | |
constrain(self, superview) { view, superview in | |
view.edges == superview.edges | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment