Swift 3; Range 'Out of bounds'
问题 I've just updated Xcode to 8.0 beta 2 and swift 3.0. After updating from swift 2.3 i'm getting a lot of errors. I have a String-extension that's converting a Range in the "self"-string to a NSRange: extension String { func NSRangeFromRange(_ range : Range<String.Index>) -> NSRange { let utf16view = self.utf16 let from = String.UTF16View.Index(range.lowerBound, within: utf16view) let to = String.UTF16View.Index(range.upperBound, within: utf16view) print("to: \(to) from: \(from)") print(self