SwiftUI 4 All In One
SwiftUI 4 All In One
https://developer.apple.com/xcode/swiftui/
WWDC22 - Apple Developer
https://developer.apple.com/wwdc22/
SwiftUI 4
SwiftUI Charts
Resizable Bottom Sheet
MultiDatePicker
struct MultiDatePickerDemo: View {
@State private var selectedDates: Set<DateComponents> = []
var body: some View {
MultiDatePicker("Choose your preferred dates", selection: $selectedDates)
.frame(height: 300)
}
}
NavigationStack and NavigationSplitView
ShareLink for Data Sharing
struct ShareLinkDemo: View {
private let url = URL(string: "https://www.xgqfrms.xyz")!
var body: some View {
ShareLink(item: url)
}
}
Table for iPadOS
struct TableViewDemo: View {
private let members: [Staff] = [
.init(name: "Vanessa Ramos", position: "Software Engineer", phone: "2349-233-323"),
.init(name: "Margarita Vicente", position: "Senior Software Engineer", phone: "2332-333-423"),
.init(name: "Yara Hale", position: "Development Manager", phone: "2532-293-623"),
.init(name: "Carlo Tyson", position: "Business Analyst", phone: "2399-633-899"),
.init(name: "Ashwin Denton", position: "Software Engineer", phone: "2741-333-623")
]
var body: some View {
Table(members) {
TableColumn("Name", value: \.name)
TableColumn("Position", value: \.position)
TableColumn("Phone", value: \.phone)
}
}
}
Expandable Text Field
Gauge
struct GaugeViewDemo: View {
@State private var progress = 0.5
var body: some View {
Gauge(value: progress) {
Text("Upload Status")
}
}
}
Gauge(value: progress) {
Text("Upload Status")
} currentValueLabel: {
Text(progress.formatted(.percent))
} minimumValueLabel: {
Text(0.formatted(.percent))
} maximumValueLabel: {
Text(100.formatted(.percent))
}
ViewThatFits
Gradient and Shadow
Image(systemName: "trash")
.frame(width: 100, height: 100)
.background(in: Rectangle())
.backgroundStyle(.purple.gradient)
.foregroundStyle(.white.shadow(.drop(radius: 1, y: 3.0)))
.font(.system(size: 50))
Grid API
Grid {
GridRow {
IconView(systemName: "trash")
IconView(systemName: "trash")
}
GridRow {
IconView(systemName: "trash")
IconView(systemName: "trash")
}
}
AnyLayout and Layout Protocol
https://www.appcoda.com/swiftui-4/
![](https://img2022.cnblogs.com/blog/740516/202208/740516-20220829154250492-2126636791.png)
swiftui 100 days
100 Days of SwiftUI
https://www.hackingwithswift.com/100/swiftui/
https://www.youtube.com/watch?v=AWZzEGwkenQ
refs
https://github.com/xgqfrms/SwiftUI-In-Action
©xgqfrms 2012-2020
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/16636243.html
未经授权禁止转载,违者必究!