AVS
AVS

Reputation: 544

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. */
}

Upvotes: 2

Views: 1956

Answers (1)

Carl Lindberg
Carl Lindberg

Reputation: 2972

Should be possible, just use the availability macros on your own class. I.e., put in API_AVAILABLE(ios(13.0)) before the @interface declaration. Or use the NS_CLASS_AVAILABLE macro the same way Apple does.

Upvotes: 5

Related Questions