swift2 - cannot invoke reduce with an argument list of type swift 2.0 -


when upgrade swift 1.2 swift 2.0 following error occurs

cannot invoke reduce argument list of type

here code

let escaped = reduce(string, "") { string, character in     string + (character == mark ? "\(mark)\(mark)" : "\(character)") 

can me how solve problem

reduce() method collections such arrays have call on list of characters can access using characters property of string, not on whole string itself:

let escaped = string.characters.reduce("") { string, character in     string + (character == mark ? "\(mark)\(mark)" : "\(character)") } 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

python - RuntimeWarning: PyOS_InputHook is not available for interactive use of PyGTK -

Fatal error: Call to undefined function menu_execute_active_handler() in drupal 7.9 -