Skip to content

Instantly share code, notes, and snippets.

@foxicode
Created February 5, 2023 18:57
Show Gist options
  • Select an option

  • Save foxicode/47d4fdac8d5c5998bdfdb2f3d0d4f9bf to your computer and use it in GitHub Desktop.

Select an option

Save foxicode/47d4fdac8d5c5998bdfdb2f3d0d4f9bf to your computer and use it in GitHub Desktop.
Propperty wrapper styling usage
import SnapKit
import UIKit
class ViewControllerLayout: Layout {
@HeaderStyle private var headerLabel
@ParagraphStyle private var paragraphLabel
required init() {
super.init()
headerLabel.text = "Header"
addSubview(headerLabel) {
$0.top.equalTo(layoutMarginsGuide.snp.top).offset(12)
$0.fillHorizontally(margin: 12)
}
paragraphLabel.text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua"
addSubview(paragraphLabel) {
$0.below(view: headerLabel, margin: 12)
$0.fillHorizontally(margin: 12)
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
class ViewController: ViewControllerWithLayout<ViewControllerLayout> {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment