Swift Tutorials: MVVM Design Pattern in iOS

preview_player
Показать описание
In this video, we will learn about MVVM (Model View ViewModel) design pattern in iOS app. We will create a login page that accepts username an d password. After successful login, display username and his email.

User validation and authentication code goes inside VM(ViewModel)
Model will store user email and username.
View: Display data on to label and error messages if any.

Рекомендации по теме
Комментарии
Автор

callback was getting nil because you wrote "completionHandler" method after calling "authenticateUser" method. In the case callback in not assigned a closure variable. If you write completionHandler before calling authenticateUser callback will have a value and you don't need to write the the dispatch too.

rohitnagori
Автор

I have two questions:
Note: I know classes are reference type while Structs are value type + I know when you make your class of type NSobject you make it visible by Objective-C + I know when you mark anything as fileprivate you make it only visible inside the .swift file that the function was declared in, But here are my questions ...

1- why did you make AuthenticationMV as a class? and of type NSobject ? while User as Struct?
2- why did you make verifyUserWith() as fileprivate?

and thank you for this amazing video

abdulazizalharbi
Автор

Hey thanks for such a great explanation. Keep up the good work.

jeetkapadia
Автор

Good tutorial. But my question is, is this actually an MVVM?

raulgonzales
Автор

Great video and explanation skill but one suggestion for you, if you improve the audio quality that it would be more effective

bhargavkumark.kaneriya
Автор

If you can make it with api's that will be more helpful. Because all have done with sample data no one have given demo with dynamic data.

MIHIROZAD
Автор

Well explain.. Keep up the great work.

DigitalHole
Автор

good tutorial ... but pay attention to your typo

imurodillo
Автор

I have a question. Why we need to inherit nsobject ?

soseyeritsyan
Автор

mvvm is first and foremost used to extract away model translation, here you extracted the logic but you are doing model translation in controller

watchit
welcome to shbcf.ru