[英]Class availability in Objective-C
I'd like to mark an entire class as available only for iOS 13+.我想将整个课程标记为仅适用于 iOS 13+。 Is this possible?
这可能吗?
I imagine running an availability check before using the class, like this:我想象在使用课程之前运行可用性检查,如下所示:
if (@available(iOS 13, *)) {
/* Use my special, iOS 13+ only class. */
}
Should be possible, just use the availability macros on your own class.应该是可能的,只需在您自己的班级上使用可用性宏即可。 Ie, put in
API_AVAILABLE(ios(13.0))
before the @interface declaration.即,在@interface 声明之前放入
API_AVAILABLE(ios(13.0))
。 Or use the NS_CLASS_AVAILABLE macro the same way Apple does.或者像 Apple 一样使用 NS_CLASS_AVAILABLE 宏。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.