Programming in Swift: Functions & Types, Episode 18: Challenge: filter & reduce | Kodeco

Practice what you have learned about filter, reduce, and sort with this series of hands-on coding challenges.

This is a companion discussion topic for the original entry at


I’m getting this error in the console when trying to replicate the Filter exercise.

Value of type ‘String.Element’ (aka ‘Character’) has no member ‘count’.

My code is:

let moreThanFour = names.filter { $0.count > 4 }

To me seems that all looks good. My Xcode version is 14.1.

Any suggestions?

Thank you,

Solved. I wrote .reduce at the end of the main names array and that’s why it was throwing the error.

1 Like