Lazy stored property in Swift Hindi tutorial

Sdílet
Vložit
  • čas přidán 12. 09. 2024

Komentáře • 59

  • @faastfood
    @faastfood Před 2 lety

    Best video on lazy till I watch on CZcams, Finally I understand the concept properly. Thanks Ravi 🙏

  • @nareshnayak4039
    @nareshnayak4039 Před 3 lety +1

    One of the best channel for iOS development. Your teaching is unique you explain the things comparing to real world that is awesome, but if you can explain in English lot many members will watch your videos

    • @CodeCat15
      @CodeCat15  Před 3 lety +1

      Am glad this video was helpful Naresh, and welcome to the channel. I keep my videos in Hindi as lot of my audience wants me to keep it in Hindi but I do try my best to add captions in the video whenever I can buddy and once again thank you for your kind words

  • @natureloverspakistan
    @natureloverspakistan Před 3 lety +2

    i was also confused but you did very good job be showing the difference with practical example

    • @CodeCat15
      @CodeCat15  Před 3 lety +1

      No problem am glad i was able to help and clear your doubts 😊

  • @shubhangisingh4376
    @shubhangisingh4376 Před 3 lety +2

    Hey Ravi, I am new to this channel but I have watched your most of videos in few days only and it was very helpful for me. I am very confused with the Provising Profiles like which certificate is used for which purpose. Can you make a video on that?

    • @CodeCat15
      @CodeCat15  Před 3 lety +2

      Hello Shubhangi, welcome to the channel and I am glad you found most of these videos helpful and worth your time. I will surely try to make a video on the provisioning profiles and their usage. Please do share this channel with your iOS developer friends or even beginners who are learning iOS development and swift programming on what's app or Facebook

  • @natureloverspakistan
    @natureloverspakistan Před 3 lety +2

    wow very helpful..perfect example . thanks master Sahb

  • @jaisinghsisodia8202
    @jaisinghsisodia8202 Před 3 lety +2

    Very well explained Ravi, now I got to know the actual difference between lazy and computed property. Could you please make a video on multithreading and how to make thread-safe properties .

    • @CodeCat15
      @CodeCat15  Před 3 lety

      more will be explained in a video than this comment but usually if you want something to just wait till you kick off another task I usually use serial queues, however I want to know if you are referring to a use case where two threads are trying to access a single resource? or something else because literally there are so many use case which I can think of here just want to get a use case similar to what you have in mind and maybe add two or three more examples to it.

    • @jaisinghsisodia8202
      @jaisinghsisodia8202 Před 3 lety +1

      Code Cat Yes Ravi, I would like to know that same time multiple thread accessing same resource.For example we are downloading multiple images and we want to pause , cancel without freezing UI. such kind of events by using operations and operation queues. If you can make video it . It would be more helpful for me . Because the way you explain. It’s hits me quickly with your examples 😊😊

  • @nagarajangeetha6586
    @nagarajangeetha6586 Před 2 lety +1

    Good Explanation , Happy to watch your videos

    • @CodeCat15
      @CodeCat15  Před 2 lety

      Thank you so much 🙂, please feel free to ask questions and do share the channel with your iOS group

  • @DigitalHole
    @DigitalHole Před 3 lety +1

    Well explain ravi.. Keep on uploading great content 🔥

    • @CodeCat15
      @CodeCat15  Před 3 lety +1

      Thank you, plz do ask questions on this topic and do share it with your iOS group

  • @shahbaze63
    @shahbaze63 Před 3 lety +1

    explaination at peak.. Thanks..

  • @sudhakard5273
    @sudhakard5273 Před 7 měsíci

    good video. What are the real time examples for lazy keyword usage?

  • @sunilchauhan-BhagatSingh
    @sunilchauhan-BhagatSingh Před 2 lety +2

    I want to start a job as ios developer plz give me some guidence . I learn swift documentation only its enough for beginner level

    • @CodeCat15
      @CodeCat15  Před 2 lety

      This is a broader discussion but I did write a blog on this on medium, here’s the link for the same I hope it helps
      medium.com/swlh/how-to-start-your-journey-as-an-ios-developer-a23b835b1fed
      If the site does not open, please try the above in incognito mode

  • @dineshgautam1583
    @dineshgautam1583 Před 3 lety

    Thank you for this great knowledge

  • @payalmalekar6529
    @payalmalekar6529 Před 3 lety +1

    Well explained 👍

    • @CodeCat15
      @CodeCat15  Před 3 lety +1

      Hello Payal, welcome to the channel. I am glad this video was helpful to you. Plz do feel free to ask questions on this topic and do share the video with your iOS group on WhatsApp or Facebook 😊

  • @Shade_with_me_7
    @Shade_with_me_7 Před 2 lety

    Hello Ravi , thanks for amazing video.
    I tried to use Lazy ,
    but when I try to use with "let" , compiler give me error "lazy can not be used on let"
    because in lazy variable as we saw , we can set value only once (unable to get updated value 100 when we set it ComplexTask.firstElement == 100) , so why "let" is not allowed ?
    also why static property and function , in this ComplexTask class ? is it related to lazy var or just demo purpose.
    and what will be best practice to use static variable or instance variable.

  • @dipikasahu3298
    @dipikasahu3298 Před 3 lety +1

    Waiting for your next video 🙂

    • @CodeCat15
      @CodeCat15  Před 3 lety +1

      Am on vacation as of now so didn’t post any video this Sunday, will post this week 😊

    • @dipikasahu3298
      @dipikasahu3298 Před 3 lety +1

      Enjoy🤘

    • @CodeCat15
      @CodeCat15  Před 3 lety

      Thank you Priyanka

  • @pratikgupta7373
    @pratikgupta7373 Před 3 lety +1

    Thanks,
    what is object mapping in swift
    will u create a detailed video on this topic

    • @CodeCat15
      @CodeCat15  Před 3 lety

      Object mapping is where you assign value from object a to a similar property in object b. There are various ways to achieve this but the one way i can tell you is the decodable protocol where swift does mapping of our json object to our swift models. I have few examples in the api series where am explaining this in detail
      Link: czcams.com/video/RiuvxmoU37E/video.html

    • @pratikgupta7373
      @pratikgupta7373 Před 3 lety +1

      @@CodeCat15 thanks

  • @ahmedpakistan3376
    @ahmedpakistan3376 Před 3 lety +1

    lazy memory sy kab remove hota ha?
    suppose lazy assing and object of class is remove lazy will remove from memory ?
    second thiing suppose strong variable we created
    so object is not created will the veriable exist in memory or not

    • @CodeCat15
      @CodeCat15  Před 3 lety +1

      Its same like other objects agar koi strong reference aapne create nahi kiya hai to use case mai swift ARC aapke lazy object ko memory se clear kar dega. Class deallocate jab hoga tab aapka lazy object bhi memory se clear ho jayega.
      Maine ARC aur strong reference behavior ARC k video mai explain kiya hai aap usse check kare ARC k is behavior ko detail mai jaan k liye
      Link: czcams.com/video/XAlXnApplk0/video.html

  • @emdutt4012
    @emdutt4012 Před 2 lety

    Brother do u have any video on access control in swift.?

  • @Umairkhan-ql5id
    @Umairkhan-ql5id Před 3 lety +1

    Why is it not safe for multi threading.

    • @CodeCat15
      @CodeCat15  Před 3 lety

      From the Swift programming documentation: If a property marked with the lazy modifier is accessed by multiple threads simultaneously and the property hasn’t yet been initialized, there’s no guarantee that the property will be initialized only once.
      Source: docs.swift.org/swift-book/LanguageGuide/Properties.html

  • @dipikasahu3298
    @dipikasahu3298 Před 3 lety +1

    In case of copy , will the retain count increase by 1 for the original one?

    • @CodeCat15
      @CodeCat15  Před 3 lety

      what do you think Priyanka? let's hear that out first and it's okay if the answer is wrong just let me know what do you think happens when you write copy and sorry for the delayed response

  • @deepikasahu8237
    @deepikasahu8237 Před 3 lety +1

    👍👍

    • @CodeCat15
      @CodeCat15  Před 3 lety

      Welcome to the channel Deepika, please do ask questions on this topic and do share the channel with your iOS group on WhatsApp or Facebook

  • @natureloverspakistan
    @natureloverspakistan Před 3 lety +1

    Please make a tutorial on combine framework using storyboard view controllers pasing data one to one and one many .

    • @natureloverspakistan
      @natureloverspakistan Před 3 lety

      Ravi bro ..???

    • @CodeCat15
      @CodeCat15  Před 3 lety +1

      Before i explain that i need to explain a concept of binding and observer property wrappers because only then we will know when to use what otherwise its going to be a little challenging as to why am i using binding or observers

    • @natureloverspakistan
      @natureloverspakistan Před 3 lety +1

      @@CodeCat15 ok sir I will wait

    • @natureloverspakistan
      @natureloverspakistan Před 3 lety

      @@CodeCat15 wese jahan tk mujh yad he ap property observer p pehly b tutorial bna chuke , will set and didset .

    • @natureloverspakistan
      @natureloverspakistan Před 3 lety +1

      oh i just checked property observer and observer property both are different..

  • @tanmayagarwal1356
    @tanmayagarwal1356 Před 2 lety

    What is the meaning of "Lazy is not thread safe"?

  • @dipikasahu3298
    @dipikasahu3298 Před 3 lety +1

    Hello Ravi,
    I have a tableview with 100 plus number of rows(dynamic data from api). Now when I get response from the api, shall I store all the 100 data in array because it will take unnecessary memory. Is there any optimised way?

    • @CodeCat15
      @CodeCat15  Před 3 lety +1

      Hello Priyanka, If your API supports pagination (top and skip) then rather than bringing 100 records from the API just request for top 30 records and then when the user scrolls down to the table view last row request the next 30 that way you can load the data a little quick. if your API does not have pagination then how you are doing it should be fine and is the preferred approach.

    • @dipikasahu3298
      @dipikasahu3298 Před 3 lety +1

      Thanks for responding. My api is not supporting pagination.

    • @CodeCat15
      @CodeCat15  Před 3 lety

      @@dipikasahu3298 okay cool then, how you are doing it should be fine, are you facing issues with your current implementation?

    • @dipikasahu3298
      @dipikasahu3298 Před 3 lety +1

      No, just wanted to confirm the correct way.

    • @CodeCat15
      @CodeCat15  Před 3 lety +1

      Cool, so was i able to answer your question? If not please do ask

  • @rajanmaheshwari
    @rajanmaheshwari Před 3 lety +1

    You should have given example why lazy is not thread-safe

    • @CodeCat15
      @CodeCat15  Před 3 lety +2

      As per apple developer documentation notes the argument is if a lazy property is not yet initialized and multiple thread access the lazy property then there’s no guarantee that it will be initialized only once. You could end up with multiple instances of that object in the memory and hence its not thread safe.
      Sorry about not explaining this in the video and good catch Rajan thank you
      Link to dev doc: docs.swift.org/swift-book/LanguageGuide/Properties.html