简体   繁体   中英

Class availability in Objective-C

I'd like to mark an entire class as available only for 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. Or use the NS_CLASS_AVAILABLE macro the same way Apple does.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM