Before Beta 5 I could use
var str = "Hello, playground"
str.bridgeToObjectiveC().containsString("Hello")
But this is not longer supported, is there a nice workaround for this, or does Swift already offer it now?
Before Beta 5 I could use
var str = "Hello, playground"
str.bridgeToObjectiveC().containsString("Hello")
But this is not longer supported, is there a nice workaround for this, or does Swift already offer it now?
You can write extension contains:
extension String {
func contains(find: String) -> Bool{
if let temp = self.rangeOfString(find){
return true
}
return false
}
}
Example:
var value = "Hello world"
println(value.contains("Hello")) // true
println(value.contains("bo")) // false