iOS 15: Introducing MVVM into your SwiftUI project - Bucket List SwiftUI Tutorial 11/12

  Переглядів 24,473

Paul Hudson

Paul Hudson

День тому

Download the completed project here: github.com/twostraws/hackingw...
Other parts in Project 14:
Introduction: www.hackingwithswift.com/book...
1. Adding conformance to Comparable for custom types: • iOS 15: Adding conform...
2. Writing data to the documents directory: • iOS 15: Writing data t...
3. Switching view states with enums: • iOS 15: Switching view...
4. Integrating MapKit with SwiftUI: • iOS 15: Integrating Ma...
5. Using Touch ID and Face ID with SwiftUI: • iOS 15: Using Touch ID...
6. Adding user locations to a map: • iOS 15: Adding user lo...
7. Improving our map annotations: • iOS 15: Improving our ...
8. Selecting and editing map annotations: • iOS15: Selecting and e...
9. Downloading data from Wikipedia: • iOS 15: Downloading da...
10. Sorting Wikipedia results: • iOS 15: Sorting Wikipe...
11. Introducing MVVM into your SwiftUI project: This video
12. Locking our UI behind Face ID: • iOS 15: Locking our UI...
Wrap up and challenges: www.hackingwithswift.com/book...
You can find the full set of videos, along with transcriptions, challenges, tests, and more, in my free 100 Days of SwiftUI course: www.hackingwithswift.com/100/...
Watch the full 100 Days of SwiftUI playlist here: • Hacking with iOS: Swif...

КОМЕНТАРІ: 22
@carlsmith358
@carlsmith358 8 місяців тому
This video really improved my understanding of how to use MVVM in SwiftUI, along with the benefits it has.
@acjazz01
@acjazz01 2 роки тому
You've created a wrong connection between ViewModel and ContentView by putting the VM inside of an extension of the ContentView, and actually MVVM says that the ViewModel must be agnostic, as it can be used in any view.
@HaraldSchubert
@HaraldSchubert Рік тому
Perfect explanation of MVVM and application to SwiftUI!
@shim2dawg
@shim2dawg 7 місяців тому
Thank you for stating MVVM is a terrible name. I have always been confused by it and it's nice to be validated.
@jamesm.6874
@jamesm.6874 Рік тому
You are an excellent teacher, thank you so much!
@shotaworld
@shotaworld 2 роки тому
Great video! Could you make a video about the redux pattern? For example, the store, actions, reducers and dispatch. Thanks!
@igorsevtsenko655
@igorsevtsenko655 2 роки тому
Hi. Could you make please video about VIPER with SwiftUI. Very interesting to watch how can we use protocols for modules connections and SwiftUI property wrappers
@maple3226
@maple3226 2 роки тому
I'm having a warning when I'm declaring the viewModel variable saying "Expression requiring global actor 'MainActor' cannot appear in default-value expression of property '_viewModel'; this is an error in Swift 6". Is there a different approach to remove this warning?
@mykytakhlamov
@mykytakhlamov Рік тому
Thank for this video and your work! I have one question: How to proper test this ViewModel via UnitTesting?
@rileybarabash221
@rileybarabash221 2 роки тому
Since we're migrating our logic from structs into classes, doesn't this have a negative affect on performance?
@JeffreyConcerto
@JeffreyConcerto 2 роки тому
Paul, why is it better to save the data via documents directory here instead of using CoreData?
@hockeyandbeyond7566
@hockeyandbeyond7566 Рік тому
When compiled under Xcode 14.0.1 I get regular run-time warnings "Publishing changes from within view updates is not allowed, this will cause undefined behavior." I have seen this in other places as well. Do you know what causes these? The code still looks correct to me.
@Ipat639
@Ipat639 8 місяців тому
I am struggling with binding viewModel's private(set) var string and ContentView's TextField, any idea?
@tinkering.online2007
@tinkering.online2007 Рік тому
I think someone should file a bug for that disappearing of the file contents :-) But XCode gets angry at me too sometimes.
@obelix8477
@obelix8477 2 роки тому
MVVM is not an acronym. Acronyms are pronounced like words. Think radar, ASCII, modem. MVVM is an abbreviation. Probably a greek or latin base somewhere in there. Also, if your fans are confused with "belts and braces" they may know braces as suspenders. This is an analogy for the parts that hold your program together. They keep the "pants up" so to speak. But this means using two ways to ensure your pants don't fall down.
@prashank
@prashank 2 роки тому
Ty Mr. Doggo
@RajeshSharmaIndia
@RajeshSharmaIndia Рік тому
View model is an independent component which should not have any information regarding views, by creating the view model class inside the view extension we are encapsulating the view model class which is resulting in tight Coupling. What problem are you solving by creating the view model class inside view extension?
@twostraws
@twostraws Рік тому
I’m struggling to find the inclination to reply to this level of rudeness, however I will at least say this: you’re facing a problem known as Chesterton’s Fence, and might want to take a little more time to think before posting these sorts of comments.
@RajeshSharmaIndia
@RajeshSharmaIndia Рік тому
With a very polite manner I am saying that I learned so many thing from your video and article , but at some point if I have doubt in something or I found its not a good way to do the thing, so its no harm that creater accept i did wrong or if you didn't ,so you had to explain the reason why you choose that approach. Lots of people followed you and apply the approach in projects . i hope you didn't find the truth is rude.
@Ipat639
@Ipat639 8 місяців тому
it is not tight coupling, it is a reminder that this view model normally should be used with this view. And it is a class declaration not a concrete object, you can instantiate it and use where you want to use.
Swift API Calls for Beginners (Networking) - Async Await & JSON
25:35
Артем Пивоваров х Klavdia Petrivna - Барабан
03:16
Artem Pivovarov
Переглядів 6 млн
Why I don't do MVVM anymore
10:56
Flo writes Code
Переглядів 6 тис.
8 Common SwiftUI Mistakes - and how to fix them!
28:05
Paul Hudson
Переглядів 49 тис.
Beginner Editor on Adobe Premiere VS. Pro on iMovie - Video Editing Showdown!
12:04
SwiftUI - Intro to MVVM | Example Refactor | Model View ViewModel
11:55
MVVM is BAD for SwiftUI - Use MVC Instead! (Yes, MVC)
13:28
Rebeloper - Rebel Developer
Переглядів 3,5 тис.
SwiftData Basics in 15 minutes
15:18
CodeWithChris
Переглядів 33 тис.
MVVM vs. MVI - Understand the Difference Once and for All
18:40
Philipp Lackner
Переглядів 22 тис.
How to use MVVM with Async Await | Swift Concurrency #14
11:42
Swiftful Thinking
Переглядів 7 тис.
Опасная флешка 🤯
0:22
FATA MORGANA
Переглядів 748 тис.
❌УШЛА ЭПОХА!🍏
0:37
Demin's Lounge
Переглядів 1,4 тис.
iPhone - телефон для нищебродов?!
0:53
ÉЖИ АКСЁНОВ
Переглядів 3,7 млн