ios - Swift: Calling instance method using class name -


i reading ios programming: big nerd ranch guide.i on chapter 10 , in chapter reading adding new row in tableview. need call

itemstore.createitem() 

here itemstore class

class itemstore {     var allitems = [item]()      func createitem() -> item{         let newitem = item(random: true)         allitems.append(newitem)         return newitem     }      init(){         _ in 0..<5{             createitem()         }     } } 

but mistake have typed class name itemstore , after dot xcode gave me option

() -> item createitem(self: itemstore) 

and have managed same thing this

let newitem = itemstore.createitem(itemstore)() 

so class method coming? syntax sugar? significance this?


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -