[swift-users] Overriding properties with limited availability

Rod Brown rodney.brown6 at icloud.com
Tue Aug 1 19:31:12 CDT 2017


Hi everyone,

Something I’ve come across in iOS 11 is that you can’t override properties that are only available on iOS 11 when deploying with a deployment target less than the current target.

For example the following code is invalid:

extension UIViewController {
    
    @available(iOS, introduced: 11.0)
    open override var additionalSafeAreaInsets: UIEdgeInsets {
        didSet {
            // Do work here only relevant to iOS 11
        }
    }   
}

This would be easily overridden in Obj-C, but I can’t do it in Swift. Is there any reason why this limitation exists?

Thanks,

Rod
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170802/75ebd855/attachment.html>


More information about the swift-users mailing list