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).

Комментарии • 37

  • @yogeshbhatt3806
    @yogeshbhatt3806 3 года назад +1

    Amazing session. Will be helpful for offline and online Applications.

  • @fazlinnouzil3946
    @fazlinnouzil3946 3 года назад +1

    Super-duper...Keep up the good work!

  • @MoAdel92
    @MoAdel92 2 года назад

    Thanks a lot , i think a complete example will be more informative specially for beginners

  • @kinshaabid3063
    @kinshaabid3063 2 года назад

    great videos, totally underrated

  • @rizulsharma8516
    @rizulsharma8516 2 года назад

    Really great videos, I just discovered your videos and I am hooked. :) Keep up the good work man.

  • @rajithkumar3424
    @rajithkumar3424 Год назад

    Great Video

  • @pawanmanjani1298
    @pawanmanjani1298 3 года назад

    Clean and easy to understand code
    I'm expecting a video twice a week
    Please...

    • @iCode_Happy_Coding
      @iCode_Happy_Coding  3 года назад +2

      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 🙂

    • @pawanmanjani1298
      @pawanmanjani1298 3 года назад +1

      @@iCode_Happy_Coding Yes I can feel the hard work
      Keep Posting.
      Thanks

  • @manjeetchoudhary5860
    @manjeetchoudhary5860 7 месяцев назад

    You are awesome 🙌 🎉

  • @everyontech2716
    @everyontech2716 Год назад

    very helpful, thanks man

  • @saurabhbisht2181
    @saurabhbisht2181 3 года назад +3

    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.

    • @iCode_Happy_Coding
      @iCode_Happy_Coding  3 года назад

      Thanks for the suggestion Saurabh, I’ll definitely try to cover it 🙂

    • @thahiraf1317
      @thahiraf1317 3 года назад

      Its also my request

    • @iCode_Happy_Coding
      @iCode_Happy_Coding  3 года назад

      Covered SSL Pinning in detail in this video 👇🏼. Please have a look.
      ruclips.net/video/HWJ3cCNdKKA/видео.html

    • @thahiraf1317
      @thahiraf1317 3 года назад

      Thanks for sharing

    • @saurabhbisht2181
      @saurabhbisht2181 3 года назад

      @@iCode_Happy_Coding Thanks Pallav. I saw it, another super Vedio with awesome example.

  • @Collins01
    @Collins01 2 года назад

    Great🔥

  • @YogeshPateliOS
    @YogeshPateliOS 2 года назад

    I think the concept of Observer patten is same as Notification Center like addObserver, removeObserver, post. Is it correct sir ji?

  • @learneverything9904
    @learneverything9904 2 года назад

    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

  • @michaeljudge761
    @michaeljudge761 2 года назад

    I have used 'var observers = NSPointerArray.weakObjects()' to hold arrays of observers without forcing a retain cycle.

  • @swatisrivastava1174
    @swatisrivastava1174 3 года назад

    Well explained

  • @vincentjoyhere
    @vincentjoyhere 3 года назад

    Excellent 👍

  • @Manojrohtela
    @Manojrohtela Год назад

    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

  • @ProductsHub365
    @ProductsHub365 2 года назад +1

    as a beginner its not easy to understand with such example.. can you please explain with some another example for observer pattern ?

  • @rajeevhiredesai5582
    @rajeevhiredesai5582 3 года назад

    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.

    • @iCode_Happy_Coding
      @iCode_Happy_Coding  3 года назад +2

      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 🙂

  • @puneetpal1466
    @puneetpal1466 3 года назад

    Nice session

  • @yogeshbhatt3806
    @yogeshbhatt3806 3 года назад

    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.

    • @iCode_Happy_Coding
      @iCode_Happy_Coding  3 года назад

      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 🙂

  • @victorriurean
    @victorriurean 9 месяцев назад

  • @jeslanala404
    @jeslanala404 Год назад

    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.

  • @morrokokiduniya4587
    @morrokokiduniya4587 3 года назад

    DownloadManager will also contain a private init method ???

  • @azhmanzare848
    @azhmanzare848 2 года назад

    what about the remove method?