Features I would like to see from Swift and its core ecosystem, to make it a robust and ergonomic language for all use cases.
- β = Unimplemented
- π = Manifesto
- βΎοΈ = Pitch
- π = Proposal
- βοΈ = Partially Implemented / Awaiting Implementation
β οΈ = In Active Review- β = Accepted / Implemented
- βοΈ = Available in Latest Version (5.6)
- π Memory ownership system
- βΎοΈ Variadic generics
- π Flexible memberwise initialization (rationale for initial rejection)
- βοΈ
async
/await
- βοΈ
async let
structured concurrency bindings - βοΈ Actors
- βοΈ Global actors
- β Distributed actors
- βοΈ
async
program entry points - β Concurrency in top-level code
- βοΈ
AsyncSequence
- βοΈ
AsyncStream
- βοΈ
- βοΈ Effectful properties (
async
andthrows
)
- β
Existentials for protocols with
Self
or associated type constraints as new type definitions - β Lightweight same-type requirements for primary associated types
- Enable new primary associated type syntax in more structural positions such as directly on arguments and returns for:
- β
Implicitly Opened Existentials, e.g.
func isReadyForFinale(_ costume: any Costume) -> Bool
- β Existential types, e.g.
func test(_: any Collection<String>)
- β Opaque types, e.g.
func evenValues(in: some Collection<Int>) -> some Collection<Int>
- β
Implicitly Opened Existentials, e.g.
- Enable secondary associated types to be constrained directly on arguments and returns for:
- β Existential types, e.g.
func test(_: any Collection where Index == Int)
- β Opaque types, e.g.
func evenValues(in: some Collection where Index == Int) -> (some Collection where Index == Int)
- β Existential types, e.g.
β οΈ Primary Associated Types in the Standard Library- βοΈ Existential types (
any
) - βοΈ Opaque types (
some
) - βΎ Extend existential types to allow protocol self-conformance
- βΎοΈ Extend metatypes with the new
meta
keyword - β Allow
some
/any
to be used with generic types, e.g.let array: any Array = [1, 2, 3]
- β Allow
some
/any
to be used with class inheritence hierarchies, e.g.let opaqueView: some UIView = MyView()
- β Regex Type
β οΈ Regex builder DSLβ οΈ Regex syntaxβ οΈ Regex literals- π More ergonomic indexing and slicing
- β Optional chaining operator (
?
) in orthogonal positions - β
if let
with any pattern match, not just optional unwraps - β
Concise syntax for duplicate identifiers in
if let
bindings
- βοΈ Result builders
- βοΈ Implicit memberwise initializer
- β Result builder protocol
- βοΈ Result builder
let
declarations - β Stateful result builders
- β Virtualized ASTs (to convert native for-in loops to specialized types, like
SwiftUI.ForEach
)
- βοΈ Property wrappers
- β More ergonomic
Codable
customization - β First-class macro system
- β Pattern-matching macros, based on the aforementioned regular expression literals
- β Procedural macros
- Based on SwiftSyntax and Mirror
- Including its own result builder DSL
- Definable
@Attributes
, so the macro can be applied to various definitions
- βΎοΈ A way to define default protocol implementations as a macro (with the ability to define helper
@Attributes
)
- βΎοΈ Dynamic property iteration using key paths
- βΎοΈ Tuple and enum key paths
- β Dependent types
- β Ability to assert that all properties on a type conforming to a protocol must also conform to that protocol (as
Codable
does)
- β Namespaces
- βΎοΈ Fully qualified name syntax
- βΎοΈ Formalized
@exported
attribute
- π C++ interoperability
- β Rust interoperability
- β COM and WinRT interoperability
- βΎοΈ Formalized generic external declarations (e.g.
@decl
) - β Upstream WebAssembly support
- β Official Swift-only testing library
- βΎοΈ Formatted command line test output
- βΎοΈ Toolchain manager
- β Official HTML documentation generation tool
- β New Clock, Instant, and Duration time types for the Standard Library
- βοΈ Open source Foundation implementation
- β Replace Foundation with modern APIs, split into individually importable submodules
- βΎοΈ Support for scripting
- βΎοΈ Dynamic loading API
- β Package editor commands
- β Official package index
- β Type-safe access to individual resource files
- βΎοΈ Package features
- βοΈ Extensible build tools (and additional package plugin APIs)
- βοΈ Package Manager Command Plugins for
swift package
- β Extensible
Product
types (added as a private API for Swift Playgrounds 4 app projects in Xcode 13.2 beta) - β Package
@Attributes
- βΎοΈ Manifest API based on Result Builders