我正在编写一个在String对象上使用bridgeToObjectiveC()的应用程序.自Beta 5以来,这不再可用.
我试图这样做:
self.myList.filter{($0 as MyClass).name.bridgeToObjectiveC().localizedCaseInsensitiveContainsString(searchText)}
哪个给我错误:
'String' does not have a member named 'bridgeToObjectiveC'
Beta 5中的等效代码是什么?
用于转换为NSString同样的
效果:
("string" as NSString).localizedCaseInsensitiveCompare("other string")
或者喜欢这个可选链接:
("string" as NSString?)?.localizedCaseInsensitiveCompare("other string")
原文链接:https://www.f2er.com/swift/318906.html