iOS Closures in Swift First Class Functions Higher Order Functions

mark gilchrist
PRO
mark gilchrist
Pro Student 32,976 Points

what is wrong with this?

in the closures course task 2 I have to below code

func removeVowels(from str: String ) -> String { let vowels = ["a","e","i","o","u","A","E","I","O","U"] return String(str.characters.filter{ !vowels.contains(String($0)) }) }

functions.swift
// Enter your code below

extension String {
  func transform(_ trans:(String)->String) -> String {
        return trans(self)
    }

      func removeVowels(from str: String ) -> String {
          let vowels = ["a","e","i","o","u","A","E","I","O","U"]
        return String(str.characters.filter{ !vowels.contains(String($0)) })
    }
}
mark gilchrist
mark gilchrist
Pro Student 32,976 Points

I am getting this error back when I submit my code

"Bummer! Make sure removeVowels accepts a String and returns a String"

2 Answers

Have you found the answer? I have the same problem.

mark gilchrist
mark gilchrist
Pro Student 32,976 Points

Andrei, No I havent I think there is something with the site rather than the code!