view raw
Jones Jones - 11 months ago 61
Swift Question

Generic parameter "Element" could not be inferred -- Swift

So I'm in an Xcode playground, trying to remove the last character from a string. I think it should be really simple, but my code isn't working.

let test = "Get rid of that L"

I get an error on the second line "Generic parameter "Element" could not be inferred"


Don't need the join bit, just do this:

let lastCharRemoved = String(test.characters.dropLast())