I've found a couple of interesting use cases. These variants make use of the rangeOfString method and I include the equality example to show how one might best use the search and comparison features of Strings in Swift 2.0
//In viewDidLoad() I assign the current object description (A Swift String) to self.loadedObjectDescription
self.loadedObjectDescription = self.myObject!.description
Later after I've made changes to self.myObject, I can refer to the following string comparison routines (setup as lazy variables that return a Bool). This allows one to check the state at any time.
lazy var objectHasChanges : Bool = {
guard self.myObject != nil else { return false }
return !(self.loadedObjectDescription == self.myObject!.description)
}()
A variant of this happens when sometimes I need to analyze a missing property on that object. A string search allows me to find a particular substring being set to nil (the default when an object is created).
lazy var isMissingProperty : Bool = {
guard self.myObject != nil else { return true }
let emptyPropertyValue = "myProperty = nil"
return (self.myObject!.description.rangeOfString(emptyPropertyValue) != nil) ? true : false
}()