I'm writing an app that uses bridgeToObjectiveC() on a String object. Since Beta 5 this is no longer available.
I'm trying to do this:
self.myList.filter{($0 as MyClass).name.bridgeToObjectiveC().localizedCaseInsensitiveContainsString(searchText)}
Which gives me the error:
'String' does not have a member named 'bridgeToObjectiveC'
What is the equivalent code in Beta 5?
Use as
to cast to NSString
for the same effect:
("string" as NSString).localizedCaseInsensitiveCompare("other string")
Or like this with optional chaining:
("string" as NSString?)?.localizedCaseInsensitiveCompare("other string")
try
_bridgeToObjectiveC()
instead of
bridgeToObjectiveC()
as follows:
self.myList.filter{($0 as MyClass).name._bridgeToObjectiveC().localizedCaseInsensitiveContainsString(searchText)}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With