I am writing UITests and recently updated to Xcode 9.
This line of code throws an error:
let deleteString = stringValue.characters.map { _ in XCUIKeyboardKeyDelete }.joined(separator: "")
The error on this line is with .joined(separator:) and says:
Type of expression is ambiguous without more context
It's inside a function meant to clear the text out of a UITextField during a UITest.
This code was working before I upgraded to Xcode 9. Any way to convert the syntax for Swift 4 / Xcode 9?
XCUIKeyboardKey is now an enum. Try this:
let deleteString = stringValue.characters.map { _ in XCUIKeyboardKey.delete.rawValue }.joined(separator: "")
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