Multi-pattern catch clauses
enum TemperatureError: Error {
case tooCold, tooHot
}
Multiple trailing closures
var body: some View {
Button(action: {
self.showOptions.toggle()
}) {
Image(systemName: "gear")
}
} ///Can now be written as this:
var body: some View {
Button {
self.showOptions.toggle()
} label: {
Image(systemName: "gear")
}
}
Synthesized Comparable conformance for enums
enum Size: Comparable {
case small
case medium
case large
case extraLarge
}
let shirtSize = Size.small
let personSize = Size.large
if shirtSize < personSize {
print("That shirt is too small")
}
self is no longer required in many places Example: inside closure.