Created
March 19, 2020 23:37
-
-
Save foxicode/511ee5d0487df47bf636fd1f33891c3e to your computer and use it in GitHub Desktop.
SnapKit example
This file contains hidden or 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 SnapKit | |
| class MyViewController: UIViewController { | |
| lazy var box = UIView() | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| self.view.addSubview(box) | |
| box.backgroundColor = .green | |
| box.snp.makeConstraints { (make) -> Void in | |
| make.width.height.equalTo(50) | |
| make.center.equalTo(self.view) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment