2020 Developer ToolsSwiftSwiftUI & UI Frameworks
WWDC20 · 55 min · Developer Tools / Swift / SwiftUI & UI Frameworks
Introduction to SwiftUI
Explore the world of declarative-style programming: Discover how to build a fully-functioning SwiftUI app from scratch as we explain the benefits of writing declarative code and how SwiftUI and Xcode can combine forces to help you build great apps, faster.
Watch at developer.apple.com ↗Code shown on screen · 4 snippets
Views are lightweight
struct SandwichDetail: View {
let sandwich: Sandwich
var body: some View {
Image(sandwich.imageName)
.resizable()
.aspectRatio(contentMode: .fit)
}
} Views are composed
struct SandwichDetail: View {
let sandwich: Sandwich
var body: some View {
Image(sandwich.imageName)
.resizable()
.aspectRatio(contentMode: .fit)
}
} View are dynamic
struct SandwichDetail: View {
let sandwich: Sandwich
private var zoomed = false
var body: some View {
Image(sandwich.imageName)
.resizable()
.aspectRatio(contentMode: zoomed ? .fill : .fit)
.onTapGesture { zoomed.toggle() }
}
} Where is truth?
struct SandwichDetail: View {
let sandwich: Sandwich
private var zoomed = false
var body: some View {
Image(sandwich.imageName)
.resizable()
.aspectRatio(contentMode: zoomed ? .fill : .fit)
.onTapGesture { zoomed.toggle() }
}
} Resources
Related sessions
-
19 min -
15 min -
36 min -
28 min -
40 min