Swiftpack.co - mezhevikin/TinyLayout as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by mezhevikin.
mezhevikin/TinyLayout 0.0.1
📐 A tiny syntactic sugar for NSLayoutConstraint. Only 50 lines of codes.
⭐️ 0
🕓 2 weeks ago
iOS
.package(url: "https://github.com/mezhevikin/TinyLayout.git", from: "0.0.1")

TinyLayout

📐 A tiny syntactic sugar for NSLayoutConstraint. Only 50 lines of codes.

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

GitHub

link
Stars: 0
Last commit: 2 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics