I have this code:
var formatterIndex = hourFormattingPattern.endIndex
let formattingPatternRange = formatterIndex ..< hourFormattingPattern.startIndex
But I'm getting an error of bad access when the second line is called. Is there a way to specify a range that reverses through the string hourFormattingPattern? After the initialization, I'm doing this:
while !stop {
//Do pattern matching and switching with string and replace char string
formatterIndex = formatterIndex.predecessor()
if formatterIndex <= hourFormattingPattern.endIndex || tempIndex <= tempString.endIndex {
stop = true
}
}
Any help appreciated. Thank you
for index in (hourFormattingPattern.startIndex ..< hourFormattingPattern.endIndex).reverse() { }