Macros
The following macros are available globally.
-
This macro provides conformance of the
CaseIterableprotocol to enums, including those with associated values.In the example below, applying
@AutoCaseIterableto this enum provides automaticCaseIterableconformance, even though these cases have associated values.@AutoCaseIterable enum UserInteractions: UserInteractionTypeable { case sliderInteraction(value: Double) case modeButton(mode: Mode) }Declaration
Swift
@attached(extension, conformances: CaseIterable, names: named(allCases) ) public macro AutoCaseIterable() = #externalMacro(module: "AutomaticEnumCaseIterableMacro", type: "AutomaticEnumCaseIterableMacro")
View on GitHub
Macros Reference