https://github.com/song-react/flexui
https://github.com/song-react/flexui
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/song-react/flexui
- Owner: song-react
- License: mit
- Created: 2020-10-12T09:36:16.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-21T05:29:37.000Z (about 4 years ago)
- Last Synced: 2025-05-21T10:50:25.749Z (about 1 year ago)
- Language: Swift
- Size: 10.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README




[](https://paypal.me/DingSongwen)
一个 UI 开发工具
# 安装
Swift Package Manager
```swift
https://github.com/DingSoung/FlexUI master
```
# 使用
UIKit 的写法
```swift
let view = UIVIew()
view.backgroundColor = .gray
view.frame = CGReact(0, 5, 200, 300)
let text = UILabel()
text.backgroundColor = .orange
text.attrbuteText = ...
text.frame = CGReact(10, 0, 200 * 0.8, 30)
view.addSubView(text)
...
func layoutSubViews() {
view.frame = ....
text.frame = ...
}
```
FlexUI的写法
```swift
let flexView = View()
.backgroundColor(.gray)
.top(0)
.left(5)
.width(200)
.height(300)
.children([
Text()
.backgroundColor(.orange)
.left(10)
.width(80%)
.height(30)
.flexGrow(1)
.content(Text.testAttrbuteString),
])
flexView.layout.calculateLayout()
flexView.recursiveSyncFrame()
```
更多用法请参考 playground