HarryExtensions 0.5.1

HarryExtensions 0.5.1

Harry Ng 维护。



  • 作者
  • pewepw

HarryExtensions

CI Status Version License Platform

示例

要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install

要求

  • Xcode 10+
  • Swift 4.2+

安装

HarryExtensions 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中 CocoaPods

pod 'HarryExtensions'

用法

1. 使用 UIView 锚点扩展实现垂直和水平堆叠

let pointStackView = VerticalStackView(arrangedSubviews: [
                availableTitleLabel,
                pointLabel
            ])
addSubview(pointStackView)
pointStackView.anchor(top: topAnchor, leading: leadingAnchor, bottom: nil, trailing: nil, padding: .init(top: 10, left: 15, bottom: 0, right: 0), size: .init(width: 0, height: 40))
        
let profileStackView = HorizontalStackView(arrangedSubviews: [
      nameLabel,
      profileImage
    ], spacing: 10)
addSubview(profileStackView)
profileStackView.anchor(top: topAnchor, leading: pointStackView.trailingAnchor, bottom: nil, trailing: trailingAnchor, padding: .init(top: 10, left: 15, bottom: 0, right: 15), size: .init(width: 0, height: 40))

StackViewExample

还包括一组方便的 Swift 扩展来提高您的生产力

作者

Harry Ng,[email protected]

许可

HarryExtensions 在 MIT 许可证下提供。有关更多信息,请参阅 LICENSE 文件。