iOS 11 (swift-4) branch
if let from = range.lowerBound.samePosition(in: view),
let to = range.upperBound.samePosition(in: view) {
offset.pointee += Int32(string[string.startIndex..<range.lowerBound].utf8.count)
length.pointee = Int32(view.distance(from: from, to: to))
return token
} else {
return nil
}

for the time being fix:
let from = range.lowerBound.samePosition(in: view)
let to = range.upperBound.samePosition(in: view)
if from != nil && to != nil {
offset.pointee += Int32(string[string.startIndex..<range.lowerBound].utf8.count)
length.pointee = Int32(view.distance(from: from, to: to))
return token
} else {
return nil
}

i suppose this is with beta6?
Using Xcode beta 5 and iOS 11 beta 7
weird. are you sure the xcode beta is active? this got fixed just a few days ago.
Yeah i am sure because i am using swift 4 branch which will not compile on xcode 8.3.3
hm, something is odd w/ your setup, it compiles both on travis and on my local machine (using Xcode 9 beta5). if you check the method signature in the API docs you see that it returns an optional value (samePosition:in).
yeah code works fine on Xcode beta 6 , if possible close the issue
great!