Wednesday, July 16, 2014

Swift - category in Swift / Extension in swift [ swift programming language apple ios]

Extension like category
“Use extension to add functionality to an existing type, such as new methods and computed properties. ”
“extension Int: ExampleProtocol {
    var simpleDescription: String {
    return "The number \(self)"
    }
    mutating func adjust() {
        self += 42
    }
}
7.simpleDescription”


0 comments:

Post a Comment

About

Powered by Blogger.