Created
February 5, 2023 18:57
-
-
Save foxicode/47d4fdac8d5c5998bdfdb2f3d0d4f9bf to your computer and use it in GitHub Desktop.
Propperty wrapper styling usage
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 | |
| 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