Apple has a good explanation of type (class) methods here .
However, their example looks like this:
class SomeClass { class func someTypeMethod() {
I see that this same example is sown everywhere.
However, I need to call my type method from an instance of my class and which does not seem to be evaluated.
I SHOULD do something wrong, but I noticed that Apple does not yet support the class properties :( I wonder if I will be going into dry water for water.
Here is what I tried (on the playground):
class ClassA { class func staticMethod() -> String { return "STATIC" } func dynamicMethod() -> String { return "DYNAMIC" } func callBoth() -> ( dynamicRet:String, staticRet:String ) { var dynamicRet:String = self.dynamicMethod() var staticRet:String = ""
Does anyone know me?
methods types ios class swift
Little Green Viper Jun 29 '14 at 1:25 2014-06-29 01:25
source share