I've implemented such class:
class MapLayoutGuide: NSObject, UILayoutSupport {
var insetLength: CGFloat = 0
init(insetLength: CGFloat) {
self.insetLength = insetLength
}
var length: CGFloat {
return insetLength
}
}
Everything was working fine, however there were new changes introduced with new iOS version: Apple changelog.
So now I'm receiving 3 errors:
Protocol requires property 'topAnchor' with type 'NSLayoutYAxisAnchor'
, Protocol requires property 'bottomAnchor' with type 'NSLayoutYAxisAnchor'
, Protocol requires property 'heightAnchor' with type 'NSLayoutDimension'
.Looking into UILayoutSupport
implementation I can see new variables:
@available(iOS 9.0, *)
var topAnchor: NSLayoutYAxisAnchor { get }
@available(iOS 9.0, *)
var bottomAnchor: NSLayoutYAxisAnchor { get }
@available(iOS 9.0, *)
var heightAnchor: NSLayoutDimension { get }
My app is iOS 8.0+
. So the question is what should I do with these values..? I can't set @available
flag and I want the code to work both with iOS 8
and 9
, but I have to override it. No conception what to do with it.
The code used to work yesterday on Xcode Beta 1
, what ofc doesn't matter atm as I want it to work on current API not previous.
It worked after cleaning the project.
@available(iOS 9.0, *)
var topAnchor: NSLayoutYAxisAnchor {
return NSLayoutYAxisAnchor()
}
@available(iOS 9.0, *)
var bottomAnchor: NSLayoutYAxisAnchor {
return NSLayoutYAxisAnchor()
}
@available(iOS 9.0, *)
var heightAnchor: NSLayoutDimension {
return NSLayoutDimension()
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With