FrameLayoutKit 7.0.5

FrameLayoutKit 7.0.5

Nam Kennic维护。



FrameLayoutKit

Platform Language Version SwiftPM Compatible License

image

FrameLayout是一个超快且易于使用的iOS和tvOS布局库。

对于Objective-C版本:NKFrameLayoutKit (已弃用,不推荐)

为什么选择它?

拒绝自动布局约束噩梦

NO YES

FrameLayoutKit支持复杂布局,包括通过简单直观的操作符语法进行链式和嵌套布局。

示例

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

安装

FrameLayoutKit 通过 Swift 包管理器(推荐)和 CocoaPods 可用。

无论如何,确保在可能使用到的地方导入项目。

import FrameLayoutKit

Cocoapods

可以将 FrameLayoutKit 作为 CocoaPod 安装。安装时,在您的 Podfile 中包含以下内容。

pod "FrameLayoutKit"

Swift 包管理器

Swift 包管理器是一个用于自动分发 Swift 代码的工具,它与 Xcode 和 Swift 编译器集成。**这是推荐的安装方法**。FrameLayoutKit 的更新将始终立即对具有 SPM 的项目可用。SPM 也直接与 Xcode 集成。

如果您正在使用 Xcode 11 或更高版本

  1. 点击 文件
  2. 添加包...
  3. 指定 FrameLayoutKit 的 git URL。
https://github.com/kennic/FrameLayoutKit.git

示例

这是 FrameLayoutKit 如何布局下面的卡片视图的。

let frameLayout = StackFrameLayout(axis: .horizontal)
frameLayout + VStackLayout {
   ($0 + earthImageView).alignment = (.top, .center)
   ($0 + 0).flexible() // add a flexible space
   ($0 + rocketImageView).alignment = (.center, .center)
}
frameLayout + VStackLayout {
   $0 + [nameLabel, dateLabel] // add an array of views
   $0 + 10 // add space with 10 px fixed
   $0 + messageLabel // add a single view
   $0.spacing = 5.0 // spacing between views
}

frameLayout
   .spacing(15)
   .padding(top: 15, left: 15, bottom: 15, right: 15)
   .debug(true)

Hello World

基准测试

FrameLayoutKit 是最快的布局库之一。请见:基准测试结果

参见:布局库基准测试项目

待办事项

  • Swift 包管理器
  • CocoaPods 支持
  • Objective-C 版本(已弃用 - 不推荐使用)
  • Swift 版本
  • 示例
  • 文档

作者

Nam Kennic, [email protected]

许可证

FrameLayoutKit 在 MIT 许可证下可用。更多信息请参阅 LICENSE 文件。