Observer Design Pattern | Behavioural Pattern | Swift | Interview Question
HTML-код
- Опубликовано: 4 окт 2024
- In this video, I’ve discussed everything about Observer Design Pattern. What is Observer Pattern, why do we use it, its basic components, real life examples, relation with pub sub pattern and its implementation in Swift (took download state observation as an example).
Amazing session. Will be helpful for offline and online Applications.
Super-duper...Keep up the good work!
Thanks a lot , i think a complete example will be more informative specially for beginners
great videos, totally underrated
Really great videos, I just discovered your videos and I am hooked. :) Keep up the good work man.
Great Video
Clean and easy to understand code
I'm expecting a video twice a week
Please...
Thanks Pawan. I wish I could do videos more frequent, but preparing, recording, editing takes lot of time. I’ll try to be consistent on weekly releases.
Thanks for your love 🙂
@@iCode_Happy_Coding Yes I can feel the hard work
Keep Posting.
Thanks
You are awesome 🙌 🎉
very helpful, thanks man
Great Example :). A request - Can you make a video on SSL Pinning at App Side & how to use the Certs to send data to Servers and get response.
Thanks for the suggestion Saurabh, I’ll definitely try to cover it 🙂
Its also my request
Covered SSL Pinning in detail in this video 👇🏼. Please have a look.
ruclips.net/video/HWJ3cCNdKKA/видео.html
Thanks for sharing
@@iCode_Happy_Coding Thanks Pallav. I saw it, another super Vedio with awesome example.
Great🔥
I think the concept of Observer patten is same as Notification Center like addObserver, removeObserver, post. Is it correct sir ji?
Pallav, Thanks a lot, You are making , amazing videos. I’m requesting you cover almost all the design patterns concepts.
Regarding this observer pattern I have a query in the context of iOS app. iOS already has NotificationCentre for this purpose do we have any additional benefits by implementing our own observers? Kindly clarify it
I have used 'var observers = NSPointerArray.weakObjects()' to hold arrays of observers without forcing a retain cycle.
Well explained
Thanks Swati 🙂
Excellent 👍
Thanks 🙂
Amazing video,
I have a query like in download manager class
are we following SOLID principle or not ? according to me we are not following
as a beginner its not easy to understand with such example.. can you please explain with some another example for observer pattern ?
Hi,
It’s a great video & informative one!
Kindly let us know about how we can make Observer objects weak while storing in Publisher’s observers list?? How we can break strong reference cycles here. Thanks in advance.
Thanks Rajeev. I’ll try to cover it in detail in one of the future videos, but one of the ways is to create a class (say WeakListener), and have a weak property in it. Assign your observer to this property, and in the array, store the object of this class. This way, array is holding the objects strongly, but that object is holding the listener weakly.
Glad that you liked the video 🙂
Nice session
Thank you 🙂
Please make a video on fixing performance issues in video players(loading from url) in list. I have faced various gliches/lags while scrolling throughout the list.
Also please make video on using xcode instruments for checking memory leaks and performance drops.
I am eagerly waiting for next session.
Thanks.
Sure Yash, ill try to cover instruments soon (in fact I’m working on one), will try to share it soon.
Happy that you found this video useful 🙂
Hello mister, may I ask you a help please? our task was was do some Order app with 3 view controllers. in 1st there are collection view with cocktails. you can click and will see a details on a second view controllers and there is a button Like there, after clicking on it it must be added inside a third view controller. so how I can share array between view controllers? I did empty array in a 1st collection view and i update every time when user click Like button inside a second view controller ( throw protocol Delegate) and a problem is share iwht this array to a third view controller. I tried use notification center but probably dont know how work with array. I did it before only with text field. my code looks l ike:
let dictionary = [basketArray]
NotificationCenter.post(name: .changeArrayNotification , object: self, userInfo: dictionary)
and it say to me Cannot convert value of type '[[Drinks]]' to expected argument type '[AnyHashable : Any]?'.
this array i fetch from Api and struct looks like
struct Drinks: Codable {
var name: String
var image: String
var instructions: String
enum CodingKeys: String, CodingKey {
case name = "strDrink"
case image = "strDrinkThumb"
case instructions = "strInstructions"
}
I fecth all inside collectionView and it work but when I try choose a few of them by clicking inside a cell at picture with label Like it must show in another view controller in another Viewcontroller like Favourite collection. so I dont know what to do) I add to array all choosen models with name and picture insdie and it work(throw protocol delegate ). but I cant give this array to another voecontroller it dont see my array.
DownloadManager will also contain a private init method ???
what about the remove method?