Observer Design Pattern | Behavioural Pattern | Swift | Interview Question

Поділитися
Вставка
  • Опубліковано 19 сер 2021
  • 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 2 роки тому +1

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

  • @fazlinnouzil3946
    @fazlinnouzil3946 2 роки тому +1

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

  • @rizulsharma8516
    @rizulsharma8516 2 роки тому

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

  • @kinshaabid3063
    @kinshaabid3063 2 роки тому

    great videos, totally underrated

  • @MoAdel92
    @MoAdel92 2 роки тому

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

  • @rajithkumar3424
    @rajithkumar3424 Рік тому

    Great Video

  • @everyontech2716
    @everyontech2716 Рік тому

    very helpful, thanks man

  • @Collins01
    @Collins01 2 роки тому

    Great🔥

  • @manjeetchoudhary5860
    @manjeetchoudhary5860 4 місяці тому

    You are awesome 🙌 🎉

  • @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

  • @vincentjoyhere
    @vincentjoyhere 2 роки тому

    Excellent 👍

  • @swatisrivastava1174
    @swatisrivastava1174 2 роки тому

    Well explained

  • @pawanmanjani1298
    @pawanmanjani1298 2 роки тому

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

    • @iCode_Happy_Coding
      @iCode_Happy_Coding  2 роки тому +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 2 роки тому +1

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

  • @puneetpal1466
    @puneetpal1466 2 роки тому

    Nice session

  • @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

  • @rajeevhiredesai5582
    @rajeevhiredesai5582 2 роки тому

    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  2 роки тому +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 🙂

  • @michaeljudge761
    @michaeljudge761 Рік тому

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

  • @morrokokiduniya4587
    @morrokokiduniya4587 2 роки тому

    DownloadManager will also contain a private init method ???

  • @YogeshPateliOS
    @YogeshPateliOS 2 роки тому

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

  • @saurabhbisht2181
    @saurabhbisht2181 2 роки тому +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  2 роки тому

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

    • @thahiraf1317
      @thahiraf1317 2 роки тому

      Its also my request

    • @iCode_Happy_Coding
      @iCode_Happy_Coding  2 роки тому

      Covered SSL Pinning in detail in this video 👇🏼. Please have a look.
      ua-cam.com/video/HWJ3cCNdKKA/v-deo.html

    • @thahiraf1317
      @thahiraf1317 2 роки тому

      Thanks for sharing

    • @saurabhbisht2181
      @saurabhbisht2181 2 роки тому

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

  • @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 ?

  • @yogeshbhatt3806
    @yogeshbhatt3806 2 роки тому

    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  2 роки тому

      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 🙂

  • @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.

  • @azhmanzare848
    @azhmanzare848 2 роки тому

    what about the remove method?

  • @victorriurean
    @victorriurean 6 місяців тому