Field Validation and MVVM in SwiftUI

Field Validation and MVVM in SwiftUI

Stewart Lynch

4 года назад

14,619 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@user-zc8ie8mq1r
@user-zc8ie8mq1r - 13.06.2023 12:12

great job but i have a comment on an issue
the prompts shouldn’t appear immediately when the user runs the app

Ответить
@jonothen2212
@jonothen2212 - 29.01.2023 01:23

I like your teaching style Sir
Lovely

Ответить
@DizzyFarbanish
@DizzyFarbanish - 25.11.2022 08:59

this isnt proper MVVM, there shouldnt be functions exposing fields in the VM, it should just be observables

Ответить
@nmbr73
@nmbr73 - 17.10.2022 12:46

Only now found this video - yet again very helpful. What I don't get with SwiftUI is, how this can be efficient?!? Take in this example isValidPasswod(): It's called to set the sign-up button's opacity, to set that button's disabled state and to set the text prompt for the password field ... so the exact same RegEx match is performed at least three times. I know it's not much in this example, but in huge applications with complex models these things could stack up pretty quickly, couldn't they?

Ответить
@brucknerdevilliers
@brucknerdevilliers - 21.07.2022 11:10

Spot on.

Ответить
@EmanNollase
@EmanNollase - 07.07.2022 10:17

This is awesome! Question though, how to validate the fields only when the button is press and add red border to the field not passed the validation? Thanks

Ответить
@jarodpaulson9439
@jarodpaulson9439 - 10.12.2021 04:52

Hi Stewart, thanks for yet another fantastic video. I downloaded the project and just to experiment I tried removing the @Published wrappers from the String properties in the view model. Obviously, the signUp() method didn't work because the view model was unable to emit the values without the wrapper. It's the console message I started receiving while modifying the text fields I'm curious about and I wonder if you have any insight? "Binding<String> action tried to update multiple times per frame."

Cheers.

Ответить
@nishadsheikh7148
@nishadsheikh7148 - 09.09.2021 20:24

Seriously it's an amazing tutorial.

Ответить
@johnjohnes698
@johnjohnes698 - 31.07.2021 22:03

Amazing video, thank you so much, I REALLY learned a LOT. Allow me to share some knowledge with you, too (I have 10 yrs of programming experience, not with swift though)

1) it's better to return the boolean result of expression itself, so instead of something like this

if expression_1 && expression_2 && expression_3 {
return true
} else {
return false
}

it's better to do something like this

return expression_1 && expression_2 && expression_3

2) with simple constant values returned from a simple boolean expression, instead of this

if some_bool {
return "abc"
else {
return "xyz"
}

you could do this

return some_bool ? "abc" : "xyz"

Ответить
@ivanman18
@ivanman18 - 15.06.2021 03:14

Great tutorial! What's the github repo of this project? Thanks!

Ответить
@virvijay37
@virvijay37 - 05.05.2021 11:03

which Tool you use to make videos

Ответить
@xTwisteDx
@xTwisteDx - 04.04.2021 07:49

WOw I'm going to say, I was scared when you said MVVM but it became really clear when you started showing it. Thank you so much!

Ответить
@zcaur7329
@zcaur7329 - 15.02.2021 22:06

Such great content. Thank you Stewart !

Ответить
@evertongrant2814
@evertongrant2814 - 15.12.2020 01:00

Awesome session but how is you deleted your @State Private all the same time

Ответить
@mhfs61
@mhfs61 - 15.11.2020 13:15

This wasn’t long at all, because it has value. It is great and clearly explained session. Thanks you for that.

Ответить
@hueydo3522
@hueydo3522 - 10.11.2020 18:56

What a king!!! Sharing valuable knowledge

Ответить
@candyman3537
@candyman3537 - 04.11.2020 10:47

I'm wondering why the isSignupComplete not a @Published variable?

Ответить
@user-cq7yb8us3o
@user-cq7yb8us3o - 20.06.2020 08:58

You are amazing 😉
Thank you so much 😊
I am waiting your videos every day.
My best wishes for you 👍😍❤️🌹🥰

Ответить
@craigcurphey5175
@craigcurphey5175 - 20.06.2020 02:03

What is a z stack?

Ответить
@henryhudson2340
@henryhudson2340 - 19.06.2020 18:59

MVVM! 😍

Ответить