Reputation: 113
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?
Upvotes: 4
Views: 723
Reputation: 998
XCUIKeyboardKey is now an enum. Try this:
let deleteString = stringValue.characters.map { _ in XCUIKeyboardKey.delete.rawValue }.joined(separator: "")
Upvotes: 7