Skip to content

Instantly share code, notes, and snippets.

@foxicode
Created March 19, 2020 23:37
Show Gist options
  • Select an option

  • Save foxicode/511ee5d0487df47bf636fd1f33891c3e to your computer and use it in GitHub Desktop.

Select an option

Save foxicode/511ee5d0487df47bf636fd1f33891c3e to your computer and use it in GitHub Desktop.
SnapKit example
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