Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift : Alternative to .classForCoder()

Given the following code:

    return TyphoonDefinition.withClass(AppDelegate.classForCoder()) {
        (definition) in

        definition.injectProperty("assembly")
    })

. . . it is necessary to use .classForCoder(), as .class() is struck out. This is certainly unintuitive compared to simply .class(). Is there an alternative that provides better readability?

like image 503
Jasper Blues Avatar asked Sep 04 '14 07:09

Jasper Blues


1 Answers

To obtain a reference to the class Object, simply use 'ClassName.self'

Example:

return TyphoonDefinition.withClass(AppDelegate.self) {
    (definition) in

    definition.injectProperty("assembly")
})
like image 113
Jasper Blues Avatar answered Nov 16 '22 02:11

Jasper Blues