KMM: Cast string to NSString get warning "This case can never succeed"
In my KMM project, I have a method to invoke Objective-C predicateWithFormat method inside it. And when I try to cast the passing string text to NSString, I got this warning "This cast can never succeed".
override fun elementWithPredicateText(text: String): AppElement {
val predicate = NSPredicate.predicateWithFormat("label CONTAINS %@", text as NSString)
val query = app.descendantsMatchingType(XCUIElementTypeAny).matchingPredicate(predicate)
return...