https://github.com/mezhevikin/tinylayout
📐 A tiny syntactic sugar for NSLayoutConstraint. Only 50 lines of codes.
https://github.com/mezhevikin/tinylayout
autolayout constraints dsl frame ios layout masonry nslayoutanchor nslayoutconstraint snapkit sugar swift swifty
Last synced: 3 months ago
JSON representation
📐 A tiny syntactic sugar for NSLayoutConstraint. Only 50 lines of codes.
- Host: GitHub
- URL: https://github.com/mezhevikin/tinylayout
- Owner: mezhevikin
- License: mit
- Created: 2022-09-18T07:08:15.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-09-18T11:11:03.000Z (over 2 years ago)
- Last Synced: 2025-01-22T11:11:34.904Z (4 months ago)
- Topics: autolayout, constraints, dsl, frame, ios, layout, masonry, nslayoutanchor, nslayoutconstraint, snapkit, sugar, swift, swifty
- Language: Swift
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TinyLayout
📐 A tiny syntactic sugar for NSLayoutConstraint. Only 50 lines of codes.
```swift
class SettingCell: UITableViewCell {
let iconView = UIImageView()
let titleLabel = UILabel()
let valueLabel = UILabel()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
addSubviews([iconView, titleLabel, valueLabel], constraints: [
iconView.leftAnchor.equal(leftAnchor, 15),
iconView.centerYAnchor.equal(centerYAnchor),
iconView.widthAnchor.equal(32),
iconView.heightAnchor.equal(32),
titleLabel.leftAnchor.equal(iconView.rightAnchor, 15),
titleLabel.topAnchor.equal(topAnchor),
titleLabel.bottomAnchor.equal(bottomAnchor),
valueLabel.leftAnchor.equal(titleLabel.rightAnchor),
valueLabel.topAnchor.equal(topAnchor),
valueLabel.bottomAnchor.equal(bottomAnchor),
valueLabel.rightAnchor.equal(rightAnchor, -15)
])
}
}```
### Swift Package Manager
```
https://github.com/mezhevikin/TinyLayout.git
```