Closed BayPhillips closed 8 years ago
Ran into this issue now that Xcode 7 GM has been released. While converting the syntax to Swift 2.0 I'm pretty sure you can now mark properties with available?
[Of course I realize after I write it that it reduces the class to one object at a time.]
I'm still migrating syntax so I'm not sure if this tack will pan out but, just as an example, I had the error on BPCompatibleAlertController.alertController ('UIAlertController only available on IOS8') so I made a global in the same file:
@available(iOS 8.0, *) private var BPCompatibleAlertController_alertController:UIAlertController?
And made the class property like this:
@available(iOS 8.0, *) private var alertController: UIAlertController { get { return BPCompatibleAlertController_alertController! } }
Fixed a few other references to BPCompatibleAlertController_alertController with version checks.
It compiles at least. Still need to see if it works.
Hey @shovas, check out the PR here: #10 .
Basically, I don't know how to run iOS 7 simulators via XCode 7 so updating to Swift 2.0 might be a bit tough... (I don't have an iOS 7 device).
I can confirm the Swift 2.0 version works fine on an iPhone 4S running iOS 7.1 :thumbsup:
Hey @adamski, do you mean the PR at #10 ? If so, awesome and perhaps I can merge it into master and make a 1.1 release.
Yes, I tested on the swift-2-support branch.
Thanks for the feedback @adamski . I've merged in my Swift 2 branch and made a 0.0.3
release!
Swift 2.0 added the ability to mark classes as available based on OS version. The biggest issue we'll have is that you cannot mark individual stored properties as available to different versions. This means that the
BPCompatibleAlertController
cannot have instances of bothUIAlertView
_and_UIAlertController
in it.Anyone have any thoughts on the issue? Maybe we'll have to add a protocol that shows a subclass of ours, one that wraps an
UIAlertView
and anotherUIAlertController
and have that protocol instantiate them appropriately based off of the OS version? Just an initial idea that I haven't had time to play around with yet.