Field Validation and MVVM in SwiftUI

  Рет қаралды 15,303

Stewart Lynch

Stewart Lynch

Күн бұрын

Пікірлер: 38
@mhfs61
@mhfs61 4 жыл бұрын
This wasn’t long at all, because it has value. It is great and clearly explained session. Thanks you for that.
@xTwisteDx
@xTwisteDx 3 жыл бұрын
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!
@ضدالظلم-د4ح
@ضدالظلم-د4ح 4 жыл бұрын
You are amazing 😉 Thank you so much 😊 I am waiting your videos every day. My best wishes for you 👍😍❤️🌹🥰
@orchetect7415
@orchetect7415 Ай бұрын
11:05 Wrapping regex string literals with hash symbols is a much cleaner and simpler solution than manually dealing with escape characters which can be error-prone when done by hand.
@jonothen2212
@jonothen2212 Жыл бұрын
I like your teaching style Sir Lovely
@StewartLynch
@StewartLynch Жыл бұрын
Thanks and welcome
@hueydo3522
@hueydo3522 4 жыл бұрын
What a king!!! Sharing valuable knowledge
@nmbr73
@nmbr73 2 жыл бұрын
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?
@EmanNollase
@EmanNollase 2 жыл бұрын
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 2 жыл бұрын
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 action tried to update multiple times per frame." Cheers.
@nishadsheikh7148
@nishadsheikh7148 3 жыл бұрын
Seriously it's an amazing tutorial.
@brucknerdevilliers
@brucknerdevilliers 2 жыл бұрын
Spot on.
@henryhudson2340
@henryhudson2340 4 жыл бұрын
MVVM! 😍
@zcaur7329
@zcaur7329 3 жыл бұрын
Such great content. Thank you Stewart !
@ivanman18
@ivanman18 3 жыл бұрын
Great tutorial! What's the github repo of this project? Thanks!
@StewartLynch
@StewartLynch 3 жыл бұрын
There wasn't one, but there is now:). Link is in the description
@ivanman18
@ivanman18 3 жыл бұрын
@@StewartLynch Thank you very much! Greatly appreciated!!
@RajifarmRopar
@RajifarmRopar 3 жыл бұрын
which Tool you use to make videos
@StewartLynch
@StewartLynch 3 жыл бұрын
I use Camtasia from Techsmith
@AhmedHamad-n7k
@AhmedHamad-n7k Жыл бұрын
great job but i have a comment on an issue the prompts shouldn’t appear immediately when the user runs the app
@StewartLynch
@StewartLynch Жыл бұрын
This is just an example of this screen. You can choose to implement it any way you like.
@candyman3537
@candyman3537 4 жыл бұрын
I'm wondering why the isSignupComplete not a @Published variable?
@StewartLynch
@StewartLynch 4 жыл бұрын
It is a computed property that is the result of the evaluation of 3 published propeties.
@evertongrant2814
@evertongrant2814 3 жыл бұрын
Awesome session but how is you deleted your @State Private all the same time
@StewartLynch
@StewartLynch 3 жыл бұрын
Sorry. I don’t understand what you are referring to. Can you give me a time stamp on the video to see what you mean?
@runQgC
@runQgC 3 жыл бұрын
@@StewartLynch He refers to the part at 12:57 when you adding @Published (or removing @State earlier in the video) in bulk edit for lack of better term. I'm curious about that one too. Thank you
@StewartLynch
@StewartLynch 3 жыл бұрын
​@@runQgC Oh. I See what is being asked. Xcode has multi-cursor support. You can access multi-cursor mode by holding down the Ctrl & Shift keys and left-clicking in your source file. An additional cursor will appear on screen for each left-click performed. From there, any key you hit will perform that action for every cursor, including highlighting text.
@runQgC
@runQgC 3 жыл бұрын
@@StewartLynch Thank you Stewart!
@craigcurphey5175
@craigcurphey5175 4 жыл бұрын
What is a z stack?
@StewartLynch
@StewartLynch 4 жыл бұрын
A SwiftUI depth stack where views are place on top of each other. You may say zee stack and I may say zed stack.
@craigcurphey5175
@craigcurphey5175 4 жыл бұрын
Being Canadian, its gotta be a zed stack, lol! So how it it different from your garden variety pushdown stack? Or a horizontal or vertical stack on a storyboard?
@StewartLynch
@StewartLynch 4 жыл бұрын
SwiftUI stacks are different from UIKit stacks. SwiftUI is a declarative ui design architecture so I can't really answer this question in a few words. Here is a web post that might clear things up, www.simpleswiftguide.com/how-to-use-stacks-hstack-vstack-and-zstack-in-swiftui-equivalent-of-uistackview-in-uikit/
@craigcurphey5175
@craigcurphey5175 4 жыл бұрын
Stewart Lynch aha! Got it. One of these days I will need to spend some time and dive in SwiftUI. Thanks Stewart, and I am getting lots out of your videos especially the ones that are ae not way over my head, lol! The git series was especially useful. Thx again.
@StewartLynch
@StewartLynch 4 жыл бұрын
Hang in there. Also sometimes you have to watch things more than once and then just practice by implementing a concept.
@johnjohnes698
@johnjohnes698 3 жыл бұрын
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"
@StewartLynch
@StewartLynch 3 жыл бұрын
Yes. Thanks. I use the ternary operator all the time. Thanks for offering an alternative
@DizzyFarbanish
@DizzyFarbanish 2 жыл бұрын
this isnt proper MVVM, there shouldnt be functions exposing fields in the VM, it should just be observables
@StewartLynch
@StewartLynch 2 жыл бұрын
True. Perhaps mistitled, but it is likely more how devs are developing with SwiftUI than with pure MVVM. Mark Moekens calls the VOODO - View - Observable Objects - Data Objecrts
SwiftUI 2.0 & Combine: Building a Form with Inline Error Validation
27:10
BeyondOnesAndZeros
Рет қаралды 11 М.
How to use Dependency Injection in SwiftUI | Advanced Learning #16
35:32
Swiftful Thinking
Рет қаралды 29 М.
Amazing remote control#devil  #lilith #funny #shorts
00:30
Devil Lilith
Рет қаралды 15 МЛН
The Quest To Make Unbreakable Glass
22:23
Veritasium
Рет қаралды 2,5 МЛН
SwiftUI Alerts - Buttons, TextFields, & Passing Errors
13:18
Sean Allen
Рет қаралды 7 М.
SwiftUI MVVM Programming with ObservableObject @Published @ObservedObject
17:57
SwiftUI 2.0: MVVM - A Practical Approach
14:28
BeyondOnesAndZeros
Рет қаралды 32 М.
Presenting Errors Globally in SwiftUI Applications
16:06
azamsharp
Рет қаралды 1,5 М.
SwiftUI MVVM Tutorial: Simple Example with ObservableObject
12:43
Logan Koshenka
Рет қаралды 20 М.