[![enter image description here][1]][1]I'm an iOS developer, I am using XIB's (Not Storyboard) and I'm guilty of having Massive View Controllers in my projects so I've been searching for a better way to structure my projects and came across the MVVM (Model-View-ViewModel) architecture. I've been reading a lot of MVVM with iOS and I tried one small task which is sign up screen. But I am getting an error in viewcontroller class. If anyone helps me, It would be great.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You get an error because you are calling the init method incorrectly, the code should look something like
let signupscreen = SignupViewModel.init(Firstname: "",
Lastname: "",
Mailid: "",
Mobilenumber: 0,
Password: "",
Confirmpassword: "")
and please use lowercase standard for parameter names,firstname
instead of Firstname
and so on.
Note that after looking at the viewDidLoad code more carefully, it looks to me like the whole init method is unnecessary since you don't need the signupscreen
object for anything so an alternative answer is to just delete the code and initialize your ui components directly.