SwiftUIKit
SwiftUI 的 UIKit 版本
示例代码
import UIKit
import SwiftUIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
Navigate.shared.configure(controller: navigationController)
.set(title: "Hello SwiftUIKit")
.setRight(barButton: BarButton {
Button({
print("Tapped the barbutton")
}) {
Label("Button 0")
}
})
view.embed {
SafeAreaView {
Table(defaultCellHeight: 60) {
[
Button("Say Hello") {
print("Hello World!")
},
HStack(withSpacing: 8) {
[
Label("Name"),
Divider(.vertical),
Spacer(),
Field(value: "SwiftUIKit",
placeholder: "Some Name",
keyboardType: .default)
.inputHandler { print("New Name: \($0)") }
]
},
Label.callout("This is some callout text!"),
ZStack {
[
Image(.blue)
.frame(height: 60, width: 60)
.offset(x: 100)
]
},
NavButton(destination: UIViewController {
View(backgroundColor: .white) {
LoadingImage(URL(string: "https://cdn11.bigcommerce.com/s-oe2q4reh/images/stencil/2048x2048/products/832/1401/Beige_Pekingese_Puppy__21677.1568609759.jpg")!)
.contentMode(.scaleAspectFit)
}
}, style: .push) {
Label("Go see a puppy")
},
Button("Show an Alert") {
Navigate.shared.alert(title: "Hello this is an Alert!",
message: "Just a test...",
secondsToPersist: 3)
},
Button("Show an Alert w/ cancel") {
Navigate.shared.alert(title: "Hello World",
message: "This is an alert",
withActions: [.cancel],
secondsToPersist: 3)
},
Button("Show a Toast Message") {
Navigate.shared.toast(style: .error, pinToTop: true, secondsToPersist: 4) {
Label("This is a test error message!")
}
}
]
}
}
}
}
}
示例视图
oneleif 项目
项目信息
此项目是一个 oneleif 活动。
如何加入oneleif
点击以下链接加入Discord服务器。
您将以有限的权限开始,在一个只有管理员才能看到的文字频道中。
要获得完全访问权限:阅读规则,在#introductions中作自我介绍,并添加一个合适的用户名。
完成以上操作后,向#start频道发一条消息通知我们,我们将为您提供完全访问权限。
问题?
请随时给我们发送邮件至:[email protected]