enum Difficulty {
@Alias("beginner")
case easy
@Alias("normal")
case medium
@Alias("challenge")
case hard
@Alias("extreme")
case expert
@Alias("ultimate")
case master(level: Int)
}
At this time, the macro is expanded as follows.
enum Difficulty {
case easy
case medium
case hard
case expert
case master
static let beginner: Self = .easy
static let normal: Self = .medium
static let challenge: Self = .hard
static let extreme: Self = .expert
static func ultimate(level: Int) -> Self {
.master(level)
}
}
At this time, the macro is expanded as follows.