Swift: MVVM Bindings Pattern (2023, Xcode 12, Swift 5, Architecture) - iOS Development

  Рет қаралды 46,075

iOS Academy

iOS Academy

Күн бұрын

Пікірлер: 66
@iOSAcademy
@iOSAcademy 3 жыл бұрын
If you enjoy my teaching style, I've started to create my own courses that you can check out here: courses.iosacademy.io/
@Harshkumar-rk6gp
@Harshkumar-rk6gp 3 жыл бұрын
Can I get the source code for the video please?
@reece5863
@reece5863 Жыл бұрын
Love how fluid your coding is my bro, it just flows. Thanks for the video.
@iOSAcademy
@iOSAcademy Жыл бұрын
Glad you enjoy it!
@AnkitGupta-hv2xe
@AnkitGupta-hv2xe 2 жыл бұрын
I’ve been watching most of your tutorials, really like your content and way of explaining. Its very helpful :-)
@iOSAcademy
@iOSAcademy 2 жыл бұрын
Thanks!
@jeffreywilkinson1471
@jeffreywilkinson1471 3 жыл бұрын
Love the teaching style and the video! Your content is fantastic. Much appreciated. 🙏
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Thank you!
@MAbbas-ih7sz
@MAbbas-ih7sz 2 жыл бұрын
When we change the textfield value then how we can bind that value with the ViewModel by using that approach ? I need Two-Way data binding by using that approach.
@Podli123
@Podli123 3 жыл бұрын
Can you make the similar tutorial with Combine , thanks for your videos 👏😺👍
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Yes, soon
@afaaqahmedsaqi
@afaaqahmedsaqi 3 жыл бұрын
Intro was Cool!
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Thanks’
@rungxanh2901
@rungxanh2901 2 жыл бұрын
Thanks Afraz for the tutorial! I'm wondering if Apple has provided a builtin support for these in UIKit already?
@sanriodin1185
@sanriodin1185 3 жыл бұрын
Great tutorial! but you makes some of us might be confused because you mix all of them in 1 file maybe next time you should split it for each file but thanks for your tutorial!
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Thanks
@aleksandrzinovev429
@aleksandrzinovev429 Жыл бұрын
can you pls explain why you call listener(value) inside bind function?
@iOSAcademy
@iOSAcademy Жыл бұрын
Its a subjective choice to trigger immediately
@linhnguyenios
@linhnguyenios 3 жыл бұрын
This is all of things I need, many thanks !
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Youre welcome
@josiasmayo7203
@josiasmayo7203 2 жыл бұрын
hi! is this still used? looks like combine can do it too? thankx in advaance
@iOSAcademy
@iOSAcademy 2 жыл бұрын
Yes
@myungsup1250
@myungsup1250 3 жыл бұрын
Great Tutorial!! Thx!!
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Youre welcome!
@Rahul-jf5kf
@Rahul-jf5kf 2 жыл бұрын
👍 If we have Generics as Date and need formatted date on ViewController where should we format it?
@evotifiga
@evotifiga 2 жыл бұрын
Great video! Tnx! I have one question: can we use only User class instead of UserListViewModel? Do we need the UserListViewModel class since it is the same as User, only that User conform to the Codable protocol?
@johncerpa3782
@johncerpa3782 3 жыл бұрын
Pretty cool !
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Thanks
@jameelshehadeh9011
@jameelshehadeh9011 2 жыл бұрын
i thought @escaping is used to mark parameters that escapes the return cycle of the function but in the bind function there is no return keyword i wonder why using the @escaping
@Ni7ram
@Ni7ram 2 жыл бұрын
same here
@vijendrayadav1352
@vijendrayadav1352 3 жыл бұрын
Hey i really enjoyed this tutorial, can anybody tell me how the bind method is updating. Thanks
@iOSAcademy
@iOSAcademy 3 жыл бұрын
It has an internal listener
@codechamp2599
@codechamp2599 3 жыл бұрын
love your videos
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Thanks!
@kittiesandbeer
@kittiesandbeer 3 жыл бұрын
What's the point of updating the listener that the value has changed? Isn't the point of the listener to detect changes?
@laurapotter6321
@laurapotter6321 2 жыл бұрын
Hi, thank you for your tutorial! What if I need to fetch images for each cell? If the url response contains title + imageURL, where should I put that image url fetching call? In the tableViewCell view?
@JLCodes
@JLCodes 2 жыл бұрын
Normally you would do that in your table view cell class. Common way is to create an extension for UIImageView and add a method that will let you download the image and cache it for better performance.
@ToanNguyen-by8xk
@ToanNguyen-by8xk 3 жыл бұрын
Is it ok if I don't create cell viewmodel? can I use the user list view model with an user object?
@bikramsapkota1571
@bikramsapkota1571 3 жыл бұрын
Great tutorial ! but how do we do Unit testing for view model after implementing observable, view model only has observable. Thanks for the tutorial.
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Thanks
@АлексйУваровъ
@АлексйУваровъ 3 жыл бұрын
So, is it Combine bindings? iOS13 and up?
@ZhouHaibo
@ZhouHaibo 3 жыл бұрын
Liked! One question, is `self.listener = listener` a call back or completion handler though it is not handled here? As you assign property listener(in Observable class) == listener(the anonymous closure in the bind call in ViewDidLoad), then when left side listener value changed, the closure will get the update automatically as they are reference to same memory address.
@karlhoffmann2665
@karlhoffmann2665 3 жыл бұрын
Nice video explaining "boxing". I'm still pretty much noob, but came across a few different flavours of MVVM implementations. Wasn't the concept of MVVM though to put all the business logic at least into the ViewModel? At least that's what MVVM patterns had in common, i thought, even though some added the service layer together with CRUD operations into a model-domain layer and some keeping service layer and model separate as dependencies of the ViewModel... Also if you have a tableview it only makes sense to hand the cells their own sub-viewmodels if they implement some logic on per cell basis. otherwise simple viewData struct (immutable) would suffice and can be handed over completely by the same immutable or mutable ViewModel all together. I know it's still a bit hairy sometimes, especially with tableviews to draw the line where presentation logic should be incorporated. probably all obsolete in the future anyhow with combine and swiftui... just some thoughts... excuse the typos :)
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Thanks
@BigCarso
@BigCarso 3 жыл бұрын
Agree this is only partly MVVM according to the typical definition
@cyberrage8658
@cyberrage8658 3 жыл бұрын
Can you make a video about: How to make a multi choice quiz, for example, One question, 2 buttons, the user presses button 1 and the question label changes as-well as the options, if the user presses the other button the question label should change but to another question deferent from the other one Button 1: “Take a left”. B2: “Take right”. The user presses B2 and then the question updates: “You see a monster on the road” and so on. BUT if the user press B1 then the story should be diferent from B2
@misrudin914
@misrudin914 3 жыл бұрын
Mantap 👍👍👍👍👍
@bunnyrabits
@bunnyrabits 2 жыл бұрын
In Real Life do we use this kind of Observer- pattern to implement MVVM, or we use RxSwift or SwiftUI ?
@iOSAcademy
@iOSAcademy 2 жыл бұрын
Either or
@lifeofcoleton
@lifeofcoleton 3 жыл бұрын
Been watching your tutorials for a long time, really like your teaching style. We are trying to get away from delegates in our products where I work, and I’m having trouble implementing a Binding pattern for the UITextFeild shouldChangeCharactersIn function. Basically, updating the VM property for every character typed in the text field. Think of response create password validation as an example. Any thoughts on how to do that? I definitely want to try extending my UITextView to inherit some sort of generic binding protocol and go from there.
@shuaiqingluo4400
@shuaiqingluo4400 Жыл бұрын
maybe search for rxswift and rxcocoa
@faridmammadov368
@faridmammadov368 2 жыл бұрын
I do not get why this pattern has MVVM in it. The pattern is exact copy of MVP, the only difference is you are not passing your View directly to Presenter but to Observable. Then you update your data in Observable and it updates the listener which is reference to View. In MVVM, your View should observe the ViewModel. In this case, though, so called ViewModel updates View through Observable which has reference to View.
@iOSAcademy
@iOSAcademy 2 жыл бұрын
Its subjective but bindings are common in mvvm
@YouBetterBeJedi
@YouBetterBeJedi 3 жыл бұрын
Hmm why reinvent the wheel if it is already all there. Combine RxSwift etc. Really naive implementation
@iOSAcademy
@iOSAcademy 3 жыл бұрын
Teaching purposes
@randlyce
@randlyce 3 жыл бұрын
so fast hard to understand what they mean
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
Advanced SQL Filtering: OR, AND, and BETWEEN Explained
4:10
Best of CES 2025
14:50
The Verge
Рет қаралды 283 М.
How to Use MVVM (Model View ViewModel) in Swift & iOS - 2023
16:50
Background Tasks in iOS (Swift & Xcode) - Beginners
25:47
iOS Academy
Рет қаралды 18 М.
MVVM + Dependency Injection in Swift | Unit Testing | iOS
29:29
Bring 3D Content Into iOS/visionOS App (+ Animations)
21:39
iOS Academy
Рет қаралды 8 М.
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН