SwiftGUI 是一个受 SwiftUI DSL 启发的实验性 API,使用 Dear ImGui 作为渲染器,并在 MacOS 和 iOS 上运行。
Window("SwiftGUI") {
Text("Hello world!")
HStack {
ForEach(1...2) { val in
Button("Click \(val)")
}
ForEach(1...2) { val in
CheckBox("Check \(val)", selectedState: true)
}
ForEach(1...2) { val in
RadioButton("Radio \(val)", activeState: true)
}
}
}
亮点
- 简单易用的 Dear ImGui 抽象
- 多平台支持(iOS 11+ 和 macOS 10.13+)
- 大量现成的 UI 组件
主题支持
- Color scheme (embedded Darcula and Light)
- Custom Fonts (embedded FiraCode)
组件
- Buttons
- CheckBox
- Color Selection
- ComboBox
- Drag
- Dock
- Image
- TextField
- Lists
- Menu
- Plotting
- Popup
- RadioButton
- SelectableFields
- Sliders
- TabBar
- Texts
- Text Editor (Code editor)
- Tooltips
- Tree
- Window
- General
- Group
- HStack
- Separator/NewLine/Spacing/Indent
- ForEach
- Perform
安装
Carthage
要使用 Carthage 将 SwiftGui
集成到您的 Xcode 项目中,请在您的 Cartfile
中指定它
github "erickjung/SwiftGUI" "0.9.3"
对于 OSX
项目,运行
carthage update --platform macOS
对于 iOS
项目,运行
carthage update --platform iOS
Cocoapods
使用 Cocoapods 将 SwiftGui
整合到您的 Xcode 项目中,在您的 Podfile
中指定
pod 'SwiftGui', '~> 0.9.3'
运行
pod install
示例
![]() |
![]() |
![]() |
---|---|---|
macOS 示例 01 | macOS 示例 02 | iOS 示例 01 |
贡献
阅读 贡献指南
许可证
使用
- Dear ImGui (1.77)
- ImGuiColorTextEdit