Using actor keyword to handle data race in swift | Actors in Swift | Hindi tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 ก.ย. 2024

ความคิดเห็น • 84

  • @CodeCat15
    @CodeCat15  2 ปีที่แล้ว +7

    This video covers core details of why swift team decided to introduce actor when we already had lock-based sync approach like dispatch semaphore and dispatch barriers, and since we are taking about data races which is different from a race condition as a bonus I have shown a small setting in Xcode called thread sanitizer which will help us in identifying data races before our code hits the apple app store (production). Do share your feedback and questions via comments and do share the video with your iOS group on whatsApp, Facebook or LinkedIn.
    Note: English subtitles will be live by end of this week for the video I am working on them, Thank you for your patience.

  • @Rahul-jf5kf
    @Rahul-jf5kf 2 ปีที่แล้ว +1

    Hello Ravi, Can You please make Video on VIPER Architecture pattern and one more Video of comparison of MVC, MVP, MVVM and VIPER

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      I am planning to create a video on MVP, in a two part video but these days my schedule is pretty jacked with no time for the content creation but I'll try to make something very soon. Thank you for your suggestion Rahul

  • @sohiniacharya3828
    @sohiniacharya3828 ปีที่แล้ว +1

    Hi Ravi, I had a question. You said enclosing the call of async function from viewDidLoad in Task makes the thread wait for the async function to finish.Does this mean Task{} makes an async function sync ? Thanks for making awesome videos btw !

    • @CodeCat15
      @CodeCat15  ปีที่แล้ว

      It's like a callback it knows which function called it and once the operation is done it sends the data of the operation back to the calling block.

  • @arbintajnawaz7200
    @arbintajnawaz7200 2 ปีที่แล้ว +4

    Very nicely explained 🙏🙏🙏 , your videos are just so easier to understand in just one go. ☺️☺️☺️☺️

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      Thanks Arbintaj am glad this was helpful, do share the same with your team 😊

  • @kanerodricks9930
    @kanerodricks9930 2 ปีที่แล้ว +5

    Thanks a lot, Ravi!! Your playlist is one of my favourite bookmarks! I constantly refer to the concurrent series, and it has helped me tremendously!

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      I am glad the playlist is helpful, more videos to be added soon the next one is on async/await

  • @lalitvinde1441
    @lalitvinde1441 6 หลายเดือนก่อน

    bro you have created let barrier = DispatchQueue(label: "barrierQueue") which is serial queue so indeed it gonna executed task serially, using .barrier flag doesn't make sense on serial queue.

  • @poojakadam8160
    @poojakadam8160 5 หลายเดือนก่อน +1

    Your explanation and examples are beyond imagination which helps everyone to understand the iOS concepts. Please make more videos on iOS concepts.

    • @CodeCat15
      @CodeCat15  5 หลายเดือนก่อน

      Glad it’s helpful Pooja

  • @akhtarabbas5760
    @akhtarabbas5760 หลายเดือนก่อน +1

    sir what if we use Struct instead of an actor in such case ?

    • @CodeCat15
      @CodeCat15  หลายเดือนก่อน +1

      The prime reason for actor is that actors can safely manage mutable state across concurrent tasks. Can structs do it? No
      Well structs can but then we have to write and handle large magnitude of cases whereas actors do that by default.
      Hope this answers your question, if not please feel free to ask more

  • @thejask2765
    @thejask2765 2 ปีที่แล้ว +1

    Briefly explained

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      Glad it was helpful, do share the video with your iOS group

  • @dheerjdhiman4983
    @dheerjdhiman4983 2 ปีที่แล้ว +1

    great efforts bro

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Thank u 🙏

  • @puneetpal1466
    @puneetpal1466 2 ปีที่แล้ว +1

    Thanks Ravi :)

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Most welcome 👍

  • @shaktiprakash
    @shaktiprakash ปีที่แล้ว +1

    Nice 👍, could you please make a video on how to use a actor as Singleton class which has only one instance throughout app lifetime

    • @CodeCat15
      @CodeCat15  ปีที่แล้ว +1

      I would not recommend that, actors can be used in a utility class but not inside a singleton. There should be no code inside a singleton that has to deal with read/write database operations because of the havoc it may create afterwards.

    • @shaktiprakash
      @shaktiprakash ปีที่แล้ว +1

      I have a Singleton class which is doing read / write using private queue with barrier So planning to change by using actor

    • @CodeCat15
      @CodeCat15  ปีที่แล้ว

      Is it doing reads in database or some global states? And is this done in a multi threaded environment? If not then you don’t need this singleton to be thread safe. Ideally I won’t recommend doing any db operations or file read write in singleton. You must create a separate utility or repository class based on your use cases

    • @shaktiprakash
      @shaktiprakash ปีที่แล้ว

      Yes it's used for global state with multi threads environment

  • @azadbaljeet
    @azadbaljeet ปีที่แล้ว +1

    Thank you very much Ravi, just before 1 week my friend suggested me to learn from your videos, really after watch these videos I am feeling very cool. In last 2 months I did not cross any interview, Now I hope. I will take some more time to these videos and then I will try again., Thank you very much again Ravi Dada.

    • @CodeCat15
      @CodeCat15  ปีที่แล้ว +1

      I'm truly grateful for your feedback and kind words about the content shared in this channel. Thank you for taking the time to express how it has been helpful to you.
      If you have any questions or need assistance on any topic, please don't hesitate to ask. I'll be more than happy to help you. Also, I would like to invite you to join the iOS Cafe community on Slack or Discord. It's a great place to connect with fellow iOS developers and engage in valuable discussions.
      Slack invite: join.slack.com/t/ios-cafe/shared_invite/zt-1xufmkzpj-uh_~FKty63rezxe0YIILhA
      Discord invite: discord.gg/gB3mhP8DNq

  • @rebellious_703
    @rebellious_703 2 ปีที่แล้ว +1

    The quality and tech. correctness of the video is great. and special thing is- it is in Hindi(Blessing for Hindi speaking Indians). I would recommend Ravi to come up with english audio as well to attract other people out side of India. Best wishes.
    One request: You should make series on background processing e.g URLSession BG download, BG process, Fetching etc.

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      Thank you for your kind words, as of now I will just be releasing videos in Hindi and I plan to keep it that way I do have English subtitles for few of my videos I add them when I get time it's a heavy task but its alright, thank you for suggesting the videos they are indeed some good topics

  • @narenderchaudhary6145
    @narenderchaudhary6145 2 ปีที่แล้ว +1

    Hi Ravi, Thanks for wonderful video you have made on SwiftUI. Please can you share some videos on auto layout with xib and storyboard and more complex UI.

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Thanks Narender, I would like to keep the channel to Swift and clean coding aspects of programming as of now I cannot wait to continue my SwiftUI playlist and add some more videos on it. As of now there are no plans to add auto layout or constraints related videos as lot of swift topics and features are pending. Maybe somewhere in future

  • @sumitbangarwa1615
    @sumitbangarwa1615 10 หลายเดือนก่อน +1

    Informational video, thanks for putting the effort and keep doing the great work❤

    • @CodeCat15
      @CodeCat15  9 หลายเดือนก่อน

      Thank you, am glad the video was helpful. Please feel free to ask questions and do share the video with your iOS group

  • @akashrevanna5327
    @akashrevanna5327 2 ปีที่แล้ว +1

    Commenting for better reach to help this video appear in recommended list for other iOS Developers.

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Thanks Aakash 😊

  • @sagardaundkar3931
    @sagardaundkar3931 2 ปีที่แล้ว +1

    Finally saw the video!!
    It was added to my watchlist.
    Thanks Ravi for explaining with real time example with apple documentations which gives crystal clear idea about the topic.

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Glad it was helpful!

  • @icodingschool9018
    @icodingschool9018 2 ปีที่แล้ว +1

    Bro Ravi I'm referring ur TH-cam channel to my entire company who is interested in swift just keep good work ... Thanks for ur efforts

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      thanks for the share bro, means a lot to me

  • @pravinparmar3622
    @pravinparmar3622 ปีที่แล้ว +1

    Why needed actor?

    • @CodeCat15
      @CodeCat15  ปีที่แล้ว

      Coz in general semaphores can cause deadlocks whereas actors handle the situation more gracefully than semaphores

    • @pravinparmar3622
      @pravinparmar3622 ปีที่แล้ว

      @@CodeCat15 thanks you

  • @pradeepkas10
    @pradeepkas10 2 ปีที่แล้ว +1

    Thanks a lot, Ravi, for sharing such valuable information, not for this video for all videos

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      It's my pleasure Pradeep, thank you for your comment and do share the video with your iOS group and feel free to ask questions

  • @Chandan-xz8cd
    @Chandan-xz8cd 2 ปีที่แล้ว +1

    Mast video hai. Bahut kuch samajh me aaya lakin acche se samajh nahi aaya 1 yaa 2 baar or dekhoonga To samajh jaaunga pura video.
    Or practice very very important.

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      Yup, jo videos maine share kiye the jaise introduction to threading, semaphore aur baaki sab unko pahele dekho aur unke concepts pahele clear karna aur uske baad aap isse dubara dekhna

  • @rohithnayak4475
    @rohithnayak4475 2 ปีที่แล้ว +1

    Thank you! Watching your new video after long time!

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      Am glad this was helpful Rohith 👍

  • @hudajawed4332
    @hudajawed4332 2 ปีที่แล้ว +1

    I really appreciate your efforts for making such quality videos , your videos help me a-lot to clear my concepts and also I appreciate the patience and time you put to read and reply everyone’s comment. Hats off 👍🏻

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      So nice of you to say that, thank you. I am glad this video was helpful please feel free to ask questions and do share the video with your iOS group 🙏

  • @AkashSingh-wk5xi
    @AkashSingh-wk5xi ปีที่แล้ว

    Hello Ravi,
    You are explaining the topics in a simpler manner, but in attached codebase when i run it on XCODE first time,
    element "i-Phone 13" is not removing from the stocks array but on very second run it is working fine. Any idea on this?

  • @prataprana2963
    @prataprana2963 2 ปีที่แล้ว

    Learned a lot..!!
    But I am just thinking to avoid race conditions we could use barriers , semaphores and many more things.
    So just to avoid isolation changes ki hum kabhi wait k bad signal na lgana bhool jaye aur lock k baad unlock  introduced actors. Which is i think more complex like we will have to use await keyword, then Need to call queue in Task struct. Also there are many drawback like we cant use inheritance.
    So my point is just ki ek isolation change ki vjhaa se is it worth to use actors?
    But i think we can use if we have heavy task or module which need high concurrency..!!

  • @shashwatsinghchauhan4527
    @shashwatsinghchauhan4527 2 ปีที่แล้ว +1

    just another fantastic explanation❣️❣️❣️❣️

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      Glad you liked it 👍

  • @jiteshsharma9377
    @jiteshsharma9377 2 ปีที่แล้ว +1

    Hi Ravi, could you please start DSA playlist or DSA Crash also in swift language. It would help a lot because your technique to teach or explain is super. So if possible please start or add Data Structure Algos also in your channel.

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      I am a little hesitant to start DSA playlist as it’s a huge ocean to step into
      Maybe few basic videos can be released but basics is something that’s not asked in interviews it’s always the intermediate and advance topics.
      It’s not like I don’t want to but then when I think about DSA am always left with a blank paper in front of me as to how do I start, what topics do I cover and how must this playlist end
      My take is just covering the basics will not do justice to such a huge topic so am still planning on this coz what matters to me is quality so I cannot just open up my laptop and start recording.
      As the channel is growing am being more strict and disciplined with the content I release and a topic like DSA surely needs good amount of planning.

    • @jiteshsharma9377
      @jiteshsharma9377 2 ปีที่แล้ว

      ​@@CodeCat15 Yes I totally agree with your words but I need to know could we start DSA in swift language or we have to brush up C++ or Java language to start in DSA. Because in swift we don't have much tutorials or internet stuff to learn or practice. So on this what's your take? Please suggest.

  • @swatitompe7726
    @swatitompe7726 2 ปีที่แล้ว +1

    Hi Ravi, I highly request you to make a video on Service oriented architecture

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      if you look at the MVVM and MVC videos you can say they follow service oriented architecture,
      by definition of SOA it means that you structure your application by decomposing it into multiple services (most commonly as HTTP services) that can be classified as different types like subsystems or tier
      All the videos in this channel promote decomposition and following SRP (single responsibility principle) which are the key in SOA,
      every decomposed layer is a self-contained unit of functionality , designed to complete a specific task.

    • @swatitompe7726
      @swatitompe7726 2 ปีที่แล้ว

      @@CodeCat15 Thank you so much Ravi for replying. Really it means a lot to me.

  • @electrowave8012
    @electrowave8012 2 ปีที่แล้ว +1

    Thank you very much, Ravi! Your videos are always helpful and interesting. In your every video there is something to learn.

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Thank you, do share the video with your iOS group on WhatsApp, slack or LinkedIn

    • @electrowave8012
      @electrowave8012 2 ปีที่แล้ว +1

      @@CodeCat15 Already shared

  • @RAHULSHARMA-iu1xq
    @RAHULSHARMA-iu1xq 2 ปีที่แล้ว +1

    Good explanation, really helpful 👍

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Thanks Rahul 👍

  • @ajaychaudhary358
    @ajaychaudhary358 2 ปีที่แล้ว +1

    Very useful ... really admire your effort ..

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      Thanks Ajay

  • @rj007love
    @rj007love 2 ปีที่แล้ว

    Super learning session Sir, Please upload a video with covering a system design for full application. That will help people to understand all the basics when they have to work on a project from scratch.

  • @renukajavheri7941
    @renukajavheri7941 2 ปีที่แล้ว

    Your videos are too helpful ... Thanks alot Ravi

  • @harya9viee
    @harya9viee 2 ปีที่แล้ว +1

    Thanks Ravi, this is pure gold.

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Thanks Ankit 🙏

  • @ganeshjoshi5692
    @ganeshjoshi5692 2 ปีที่แล้ว +1

    Great video! Keep it up. 👍🏻

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Thank you! 👍

  • @atmaramsawant2393
    @atmaramsawant2393 ปีที่แล้ว

    Nice video Ravi. Very helpful.

  • @bhuvideveloper3972
    @bhuvideveloper3972 2 ปีที่แล้ว +1

    thankyou ravi sir, this kind of information 🙂

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      Glad this was helpful, plz feel free to ask questions and do share the video with your iOS group

    • @bhuvideveloper3972
      @bhuvideveloper3972 2 ปีที่แล้ว

      @@CodeCat15 sure

  • @subhadeepchakraborty4638
    @subhadeepchakraborty4638 2 ปีที่แล้ว +1

    Good video, learn new concepts.

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Thanks for watching, do share the same with your iOS group and feel free to ask questions on this topic

    • @subhadeepchakraborty4638
      @subhadeepchakraborty4638 2 ปีที่แล้ว

      @@CodeCat15 Please create some videos on Clean Swift Architecture.

  • @anandmishra3926
    @anandmishra3926 2 ปีที่แล้ว

    loved this.

  • @piyushagrawal08
    @piyushagrawal08 2 ปีที่แล้ว

    Awesome video!

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Thanks Piyush, glad this was helpful. Please feel free to ask questions and do share the video with your iOS group