https://github.com/octree/fluid
Use a declarative syntax to build your user interface using UIKit like SwiftUI. 使用类似 SwiftUI 的声明式语法布局 UIKit 视图。
https://github.com/octree/fluid
layoutengine swiftui uikit
Last synced: 11 months ago
JSON representation
Use a declarative syntax to build your user interface using UIKit like SwiftUI. 使用类似 SwiftUI 的声明式语法布局 UIKit 视图。
- Host: GitHub
- URL: https://github.com/octree/fluid
- Owner: octree
- License: mit
- Created: 2021-12-30T04:37:13.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-11-08T09:45:12.000Z (over 3 years ago)
- Last Synced: 2025-07-15T05:58:23.261Z (11 months ago)
- Topics: layoutengine, swiftui, uikit
- Language: Swift
- Homepage:
- Size: 361 KB
- Stars: 15
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fluid

**Fluid** is powered by `ResultBuilder` and a custom layout engine. You can uses a declarative syntax to build your user interface using `UIKit` like `SwiftUI`. Your code is simpler and easier to read.
## Examples

```swift
HStack(spacing: 16) {
self.imageView
.resizable()
.aspectRatio(1)
.frame(width: 80)
.overlay {
self.editButton
.resizable()
.frame(width: 25%, height: 25%)
.offset(x: -3, y: -3)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomTrailing)
}
VStack(alignment: .leading) {
nameLabel
detailLabel
}
Spacer()
chevronImageView
.resizable()
.frame(width: 20, height: 20)
}
.padding()
.background(backgroundView)
```
## Installation
### Swift Package Manager
- File > Swift Packages > Add Package Dependency
- Add https://github.com/octree/Fluid.git
- Select "Up to Next Major" with "1.0.0"
## License
**Fluid** is available under the MIT license. See the LICENSE file for more info.