Kalzem
Kalzem

Reputation: 7501

How to make some protocol methods only available for specific iOS version?

Is it possible to have something close to this:

protocol FooBarDelegate: class {
    func foo()
    if #available(iOS 10.0, *) {
        func bar()
    }
}

?

Upvotes: 2

Views: 966

Answers (1)

user28434'mstep
user28434'mstep

Reputation: 6600

Yes, it is possible:

protocol FooBarDelegate: class {
    func foo()

    @available(iOS 10.0, *)
    func bar()
}

Upvotes: 8

Related Questions