弃用 Swift 中的枚举值
Deprecate enum value in Swift
是否可以将 Swift 中的枚举值标记为已弃用?
我试过了
enum RelativeDays {
case today, tomorrow, @available(*, deprecated, message: "Don't live in the past! Cherish the moment and look forward to the future!") yesterday
}
但是我收到一个编译错误,指出在注释所在的位置需要一个标识符。
我认为这只是语法:
enum RelativeDays {
case today
@available(*, deprecated, message: "Don't live in the past! Cherish the moment and look forward to the future!")
case tomorrow
}
作品:
是否可以将 Swift 中的枚举值标记为已弃用?
我试过了
enum RelativeDays {
case today, tomorrow, @available(*, deprecated, message: "Don't live in the past! Cherish the moment and look forward to the future!") yesterday
}
但是我收到一个编译错误,指出在注释所在的位置需要一个标识符。
我认为这只是语法:
enum RelativeDays {
case today
@available(*, deprecated, message: "Don't live in the past! Cherish the moment and look forward to the future!")
case tomorrow
}
作品: