Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Closures in Swift First Class Functions Higher Order Functions

Aananya Vyas
Aananya Vyas
20,157 Points

it says : Your code could not be compiled. Please click on "Preview" to view the compiler errors. and I cant figure out

i'm confused

functions.swift
extension String {

    func transform(_ arguement:(String) -> String) -> String {

        return arguement(self)

    }

func removeVowels(from value: (String)-> String) -> String {
  var output = ""
        for char in value.characters {

            if !(char == "a" || char == "A" || char == "e" || char == "E" || char == "I" || char == "i" || char == "o" || char == "O" || char == "u" || char == "U") {
                output.append(char)
            }
        }
        return output

    }
}

1 Answer

Heidi Puk Hermann
Heidi Puk Hermann
33,366 Points

Almost there! The issue is when you define your function

func removeVowels(from value: (String)-> String) -> String {

you set the variable as a closure, but it should just be a simple string; should look like the following...

func removeVowels(from value: String) -> String {

The rest of your code works fine :)