Function not being called through delegate in Swift -


i can't app execute changecard() after abc() finishes executing. 2 functions in different classes. here code below. appreciated!

protocol networkcontrollerdelegate {     func changecard() }  class networkcontroller {     var networkcontrollerdelegate: networkcontrollerdelegate?      func abc () {     //do here     networkcontrollerdelegate?.changecard()     } }  class view: uiviewcontroller, networkcontrollerdelegate {     var networkcontroller = networkcontroller()      func changecard() {     //do here     networkcontroller.networkcontrollerdelegate = self     } } 

i've read similar questions on stackoverflow past few hours still can't figure out. thanks!

try moving following line viewdidload of view controller delegate set prior use.

networkcontroller.networkcontrollerdelegate = self 

also, might want think making networkcontrollerdelegate variable in networkcontroller weak avoid retain cycles.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -