Constrained existential types
About 2 min
Constrained existential types êŽë š
HACKING WITH SWIFT
What's new in Swift?
Constrained existential types | Changes in Swift 5.7
Constrained existential types
Available from Swift 5.7
SE-0353 (apple/swift-evolution
) provides the ability to compose SE-0309 (apple/swift-evolution
) (âUnlock existentials for all protocolsâ) and SE-0346 (apple/swift-evolution
) (âLightweight same-type requirements for primary associated typesâ) to write code such as any Sequence<String>
.
Itâs a huge feature in its own right, but once you understand the component parts hopefully you can see how it all fits together!
Other Changes in Swift 5.7
if let shorthand for unwrapping optionals | Changes in Swift 5.7
if let shorthand for unwrapping optionals
Multi-statement closure type inference | Changes in Swift 5.7
Multi-statement closure type inference
Clock, Instant, and Duration | Changes in Swift 5.7
Clock, Instant, and Duration
Regular expressions | Changes in Swift 5.7
Regular expressions
Type inference from default expressions | Changes in Swift 5.7
Type inference from default expressions
Concurrency in top-level code | Changes in Swift 5.7
Concurrency in top-level code
Opaque parameter declarations | Changes in Swift 5.7
Opaque parameter declarations
Structural opaque result types | Changes in Swift 5.7
Structural opaque result types
Unlock existentials for all protocols | Changes in Swift 5.7
Unlock existentials for all protocols
Lightweight same-type requirements for primary associated types | Changes in Swift 5.7
Lightweight same-type requirements for primary associated types
Distributed actor isolation | Changes in Swift 5.7
Distributed actor isolation
buildPartialBlock for result builders | Changes in Swift 5.7
buildPartialBlock for result builders
Implicitly opened existentials | Changes in Swift 5.7
Implicitly opened existentials
Unavailable from async attribute | Changes in Swift 5.7
Unavailable from async attribute