Using Xcode 7 beta / iOS 9 beta. I have a UIViewController subclass that implements the UIPopoverPresentationControllerDelegate protocol. The deployment target is set to iOS 7.1. If I do this:
//MARK: - UIPopoverPresentationController delegate methods
func popoverPresentationControllerDidDismissPopover(popoverPresentationController: UIPopoverPresentationController) {
// my code
}
I get the error "UIPopoverPresentationController is only available on iOS 8.0 or newer".
If I use the fix-it suggestion to wrap with @available:
@available(iOS 8.0, *)
func popoverPresentationControllerDidDismissPopover(popoverPresentationController: UIPopoverPresentationController) {
// my code
}
I get the error "Protocol 'UIPopoverPresentationControllerDelegate' requres 'popoverPresentationControllerDidDismissPopover' to be available on iOS 7.1.0 and newer".
How can I indicate that my view controller implements this delegate protocol and define the method if I need the deployment target to be iOS 7.1 (obviously, I provide an alternative way to show my popover in iOS 7.1)?
BTW the second error message is misleading at best, since the delegate protocol, and therefore the specifiid method, are not even available on iOS 7.1.