Code:
let startIndex = oldString.characters.index(oldString.startIndex, offsetBy: range.location)
let endIndex = String.Characterview corresponding to 'startIndex' .index(startIndex, offsetBy: 5)
Prior to migrating to Swift 3, the above line was:
let endIndex = startIndex.advancedBy(5)
I know the docs say that advancedBy
should be converted to:
Collection.index(index, offsetBy: delta)
but when I do the above code I get this error:
Protocol Collection can only be used as a generic constraint because it has Self or associated type requirements
Question:
So what is it that I need to do here? I feel like this is something simple and I'm just barley missing it. I've been all over the docs and the internet.