I convert my code from swift 3 to swift 4 and get this error in the following code. I get this even when I try to use flatmap to align the array
Cannot convert a String value to the expected argument type 'String.Element' (otherwise a character)
if favoritedProducts.contains("helloWorld") {}
The bottom line of code does not return [String], but is "[String.Element]". How do I convert it to [String]. If I try to use it as [String], it says that it always fails.
let productIDs = allItems.flatMap{$0.productID}
Nevin source
share