Can anyone tell me why the first two loops below don't work on iOS11, but work on iOS13, and the last two loops work on iOS11 and iOS13?
It seems like iOS13 allows for NSData to be used as Data, automatically, but not iOS11? Isn't this something that should be clearly documented someplace?
extension NSData {
@objc func test() {
print("Data is \(self)")
// works with iOS13, but not iOS11
self.forEach {
print("byte is \($0)")
}
// works with iOS13, but not iOS11
for byte in self {
print("byte is \(byte)")
}
// works with iOS13, and iOS11
(self as Data).forEach {
print("byte is \($0)")
}
// works with iOS13, and iOS11
for byte in self as Data {
print("byte is \(byte)")
}
}
}