After working with Swift for some time I found there are lot of things that aren’t there out of the box as with other languages. Following are some extensions that I think are useful for day to day working
Accessing string element by index
extension String {
subscript(i:Int) ->Character {
let index = self.index(self.startIndex, offsetBy: i)
return self[index]
}
}
#useful #development #swift #extension #swift-extensions