swift - Binding ViewModel to ViewController (ReactiveCocoa) iOS -


i implementing simple facebook/google login now. trying apply mvvm pattern reactivecocoa in project. not able bind viewmodel viewcontrollers . tried cocoaactions not able make work.

view model :

let name = mutableproperty<string>("") let email = mutableproperty<string>("") let phoneno = mutableproperty<string>("") let referal = mutableproperty<string>("")  var fbloginaction:action<onboardingviewcontroller,bool,nserror> 

view controller :

        //mark: signup binding     let logincocoaaction = cocoaaction(viewmodel.fbloginaction., input:())     signupview.fbbtn.addtarget(logincocoaaction, action: cocoaaction.selector, forcontrolevents: .touchupinside) 

its been while since question posted. since then, rac 5.0.0 has been released makes lot easier, ui bindings:

assuming, have fbloginaction ready defined in view model, can bind action button in view controller this:

signupview.fbbtn.reactive.pressed = cocoaaction(fbloginaction, input: self) 

your original problem because provided () input, input of fbloginaction defined onboardingviewcontroller.

depends on whether meant , need onboardingviewcontroller input fbloginaction, can posted above input: self, or if don't need input, can change to

let fbloginaction:action<(),bool,nserror> 

and

signupview.fbbtn.reactive.pressed = cocoaaction(fbloginaction) 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -