swift의 클로저란?

2015. 4. 8. 18:11Swift

In Swift functions are just named Closures.

스위프트에서 함수는 단지 이름을 가진 클로저이다.

 

func repeat(count: Int, task: () -> ()) {

    for i in 0..count {

        task()

    }

}

repeat(2, {

    println("Hello!")

})

 

출처 : 애플 스위프트 소개 동영상 (402_sd_introduction_to_swift.mov-, attachment)