Closure in swift (escaping, non-escaping, autoclosure) Hindi tutorial

Поділитися
Вставка
  • Опубліковано 2 сер 2024
  • Closure in swift for beginners can be challenging but this simple closure swift tutorial covers most of it.
    This video covers how to write closures in swift, escaping in swift, non-escaping in swift and autoclosure in swift.
    The main idea behind this closure swift tutorial was to explain in simple words on how easy it is to write the syntax of closure and how closure should be used in swift programming
    I hope with this video you can answer closure ios swift interview questions and clear the round.
    Closure part 1 video: • Closures in Swift Hind...
    Chapters covered in today's video
    0:00 introduction
    0:18 topic for today's session
    1:28 syntax revision of closure
    4:07 typealias with closure
    5:23 function call sequence with closure
    9:46 autoclosure
    11:16 escaping and non-escaping closure
    14:47 conclusion
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ✅ Subscribe to the channel and stay ahead of everyone by following the right way for writing clean code in swift. 🔥🔥🔥🔥🔥
    🔗Click on the link to subscribe: ua-cam.com/users/codecat?sub...
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    -----------------------------------------------------------------------------------------------------------------------
    📥 Download the source code from
    Github: github.com/codecat15/UA-cam-...
    Google Drive: drive.google.com/open?id=1v45...
    -----------------------------------------------------------------------------------------------------------------------
    🎶 Royalty-free Music: www.bensound.com
    ############################################
    Connect with me on social media
    📧: codecat15@gmail.com
    🐦: / codecat15
    Facebook: / code.cat.792
    Github: github.com/codecat15
    ###########################################
    #escapingInSwift #swiftClosure #closuresSwift

КОМЕНТАРІ • 142

  • @madmaxcoder6209
    @madmaxcoder6209 4 роки тому +54

    In my opinion Ravi has explained Closures far better than Sean Allen and Let’s build that app channel or any other channel.
    He is India version of making rich quality content on swift and helping the developer community.
    Can’t wait till he starts teaching other topics i wonder how many thing we will re-learn from him

    • @tushargore8912
      @tushargore8912 4 роки тому +3

      Yo Man, I agree, His depth of knowledge is superb and his way of teaching is too good, He is really a Indian apple documentation for us. which teach us How? Why? and what make it good.
      Thanks Codecat.

    • @CodeCat15
      @CodeCat15  4 роки тому +9

      @@tushargore8912 Indian apple documentation was a new compliment thanks hahaha, I think every developer should know at least what they are coding and why and what could be the impact of this code. Thank you for such wonderful and kind words

    • @CodeCat15
      @CodeCat15  4 роки тому +9

      @madmax coder: Sean Allen and Let's build the app are good channels no doubt and I am honored to know that this channel is being compared to such wonderful channels, slowly I will release more content for the community and will share my views on multiple topics. Once again I am thankful for your comments and good to know that this channel is being helpful for swift devs.

    • @harshitjain7428
      @harshitjain7428 3 роки тому +2

      ​@@CodeCat15 Yes honestly, you have really very great content, although I just want to let you know your videos are not in sequence, I was trying to see API Calls playlist and there after watching one video when I went to another It started explaining POST, and gave references to previous videos of GET. which wasn't there in playlist, could you please rearrange and cross check your playlists?

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

      @@harshitjain7428 Exactly Harshit...I also faced the same issue. I also commented the same...Lets see.

  • @sharathchandra8298
    @sharathchandra8298 3 роки тому +3

    Whenever I just got stucked up trying to understand something , Ravi's videos actually explains everything in detail and also helps with other related topics too . Your explanation is really so simple and easy to understand .

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      I am glad these videos are helpful Sharath, and thank you for your kind and bright words 👍

  • @harshtokas123
    @harshtokas123 3 роки тому +3

    I am only halfway through the video right now, and as soon as you explained what the real meaning of CPU resource wastage is, by illustrating an unwanted function call, I told myself this is the best explanation that I have ever seen. Had to comment and let you know even though I am not yet done watching.

    • @CodeCat15
      @CodeCat15  3 роки тому

      Welcome to the channel Harsh, I am glad this video was helpful 😊 please feel free to ask questions and do share the video with your iOS group

  • @ashishnimbria1785
    @ashishnimbria1785 4 роки тому +4

    You make developer's life easier dude. Thanks a lot..!! You teach in a very easy and professional way that anybody can understand easily. :)

    • @CodeCat15
      @CodeCat15  4 роки тому +1

      Hello Ashish, welcome to the channel. Thanks for the kind words dude means a lot, am glad this video was helpful to you. Please feel free to ask questions if you have any and do share the channel with your iOS group or with anyone who wants to learn swift programming the right and easy way 😊

  • @KARMA-nf9ni
    @KARMA-nf9ni 4 роки тому +2

    Great job buddy .. keep it up .. we are waiting for yours videos

    • @CodeCat15
      @CodeCat15  4 роки тому

      I am glad this video was helpful for you, thank you for your comment, do subscribe and share it with your iOS group

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

    So, one should use closure as a function parameter in place of function itself as a parameter value due to function call sequence. Got this point for the first time. Great!

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

      these were one of those times I was experimenting and trying weird things with closures and came across this so thought of sharing what closures can do.

  • @harshtokas123
    @harshtokas123 3 роки тому +1

    Ravi please do upload more and more such videos where you help us understand tech jargon through simple and relatable use cases. Every other UA-camr simply gives their own version of a textbook definition but you really make a point that sticks around and it makes me reflect on it later at a conceptual level.

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      Simplicity is what I always try to aim for 😊

  • @Techopia
    @Techopia 4 роки тому +1

    Yes . Agree with others. I have seen many videos of closures and j was not sble to understand but after watching this video i am able to understand 70% about closure. I have a suggetion . Please make video on equtable , comparable , Iteratable , hashable and subscript. Thank you.

    • @CodeCat15
      @CodeCat15  4 роки тому

      I am glad this video was helpful to many devs trying to get the essence of closure, I agree with your request as i think this is something that needs to be covered from an interview point of view as well, actually there are lot of topics on the back burner but for some reason i been getting lot of requests on swiftui videos and hence am making them, but let me get back to swift programming in few weeks and start with something very interesting.

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

    Awesome!!!

  • @engineerPlanet
    @engineerPlanet 3 роки тому +1

    Nicely Explained

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

    Appreciate your hard work in making those videos. I learn many things from your channel.
    Thank you for making those videos.

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

      Thanks Nikhil, please feel free to ask questions and do share the channel with your iOS group

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

    Bahot badhiya content bhai, the explanation is very good. First-time closure samajh aa gaya easily.

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

    Hey i like you content very much , and i think you missed the very imp concept in closure that in memory management inside closure
    Hope you make a video soon on that topic ..
    Thanks keep going keep motivating us..

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

    Nice explanation bro

  • @arbazsheikh9604
    @arbazsheikh9604 11 місяців тому

    Thank u very much such informative tutorial it would be very helpful if there's specific video or recommendation for escaping and non escaping closures.
    Thanks in advance.😊

  • @uttamsahu6965
    @uttamsahu6965 3 роки тому +1

    Awesome job Ravi 🙏

    • @CodeCat15
      @CodeCat15  3 роки тому

      am glad this was helpful

  • @rajeshchouhan7544
    @rajeshchouhan7544 5 місяців тому

    Maza aa gya
    Thank you Ravi❤

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

    Superb

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

      I am glad this was helpful Vaibhav.

  • @ramgade2433
    @ramgade2433 4 роки тому +1

    Thanks for a Great explanation of closures.

    • @CodeCat15
      @CodeCat15  4 роки тому

      Do feel free to ask questions Ram and do share this with your iOS group on WhatsApp or Facebook

  • @rj007love
    @rj007love 3 роки тому +2

    @codeCat - Thanks Sir, very informative video. I would love to learn more from you.

    • @CodeCat15
      @CodeCat15  3 роки тому

      Thanks for the comment Anil, there's more to come regarding swift programming in the coming days. If you have any questions then please feel free to ask and do share the channel with your iOS group on social media.

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

    Hello Ravi can u make a one video about the memory leak in closure i seen u r video its really good and easy to undestand

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

    All videos are great and we get good knowledge thanks for sharing
    Explanation are also very good

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

      Thank you for your kind words

  • @jitu4u
    @jitu4u 3 роки тому +1

    You are a very good tutor brother. Thanks!!

  • @kMustafaSiddique
    @kMustafaSiddique 3 роки тому +1

    best closure describing video I have ever seen. TBH.

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      Thank you Mustafa I am glad this was helpful :)

    • @kMustafaSiddique
      @kMustafaSiddique 3 роки тому

      @@CodeCat15 I need to connect with you if it is possible as I want to make my career in iOS. I have been learning iOS development for 8 months, but I need a mentor someone like you who has a good grip over iOS stuff.

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

    Hi Ravi, like first video, if we declare like this
    let additionClosure: (Int, Int) -> Int = {
    (number1, number2) in
    return number1 + number2
    }
    It also accepted. instead of (number1: Int, number2: Int)

  • @KTV-1996
    @KTV-1996 Рік тому +1

    vary helpfull learnins, thank you for your efforts, god bless you

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

      Thank you for the kind words Shivam, am glad the video is helpful

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

    Thanks for this video, the only remark is that is better to stick with one voice language switching between english and hindi making hard to follow.

  • @abhishekgupta-wn9mz
    @abhishekgupta-wn9mz 3 роки тому +1

    Very nice explanation.

    • @CodeCat15
      @CodeCat15  3 роки тому

      Thank you Abhishek, plz feel free to ask questions on this topic and do share this video with your iOS group on WhatsApp or Facebook

  • @hitendralariya4494
    @hitendralariya4494 3 роки тому

    @Ravi: @autoClouser is escaping or non-escaping?

  • @palakgarg8535
    @palakgarg8535 3 роки тому +1

    Thank you Ravi for the awesome videos. Please make a video on Capture list.

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      Awesome i am glad this was helpful, i will try to make a video in coming days for capture list as well palak, do share this video with your friends who are iOS developers OR who are learning swift on whatsapp group or Facebook

  • @pushkarajpatil4787
    @pushkarajpatil4787 3 роки тому +1

    CodeCat: Nice video, got idea of so many things related to closure.
    Function call sequence with closure is so confusing though, while calling printGoodMorningMessage you have sent only one parameter within () these brackets & closure body was outside the same. I thought it has to be sent within (), tried that & it worked too (below)
    printGoodMorningMsg(flag: true, name: { () -> String in
    return name
    })

  • @nsmusic2695
    @nsmusic2695 3 роки тому +1

    thanks Ravi

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

    You explained Closure part very well but still i am not getting auto closure completely.

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

    Capital list with closures. I think that is most important topic when you are working with closure especially during heavy weight / api functions

  • @Chandan-xz8cd
    @Chandan-xz8cd 3 роки тому +2

    sir nice tutorial, lakin aapko escaping closer kaa 1 example dena chahiye tha. or acche se samajh me aa jaata... and your video is a Premium Quality

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      Escaping closure humne api series mai bahut use kiya hai aur vaha maine usse cover kiya hai, aur isiliye maine is video mai jayada escaping closure k baare mai jayada nahi bola. Video aur channel dono ko share zaroor karna aapne iOS group k saath and thank u for your kind words Chandan 😊

    • @Chandan-xz8cd
      @Chandan-xz8cd 3 роки тому

      @@CodeCat15 ok sir

  • @mukulbakshi28
    @mukulbakshi28 4 роки тому +1

    Very Nice Video Bro, Wating for some Advance Topics. Good work for the community.

    • @CodeCat15
      @CodeCat15  4 роки тому +1

      Thanks @Mukul for your kind words, am just trying to explain what’s the right technique that every iOS developer should know. I am really glad that these videos are being helpful to the community. Btw regarding the advance topics are there any specific topics you want me to target?

    • @mukulbakshi28
      @mukulbakshi28 4 роки тому +1

      Code Cat 😊Would love to see Operation queues, GCD, memory management, Concurrency. 👍

    • @CodeCat15
      @CodeCat15  4 роки тому

      Cool, and it’s been a while i talked about them after the threading series. Good that you raised this thanks @Mukul

    • @mukulbakshi28
      @mukulbakshi28 4 роки тому

      Code Cat thanks its Mukul

    • @CodeCat15
      @CodeCat15  4 роки тому

      Oops sorry about the typo @Mukul

  • @azeemusmani1430
    @azeemusmani1430 4 роки тому +1

    I have just finished this beginner playlist. Please Suggest the next playlist to start which i can complete as a whole from start to end.

    • @CodeCat15
      @CodeCat15  4 роки тому +1

      Protocol oriented programming and then watch code like a pro

  • @RahulVerma-tv6gq
    @RahulVerma-tv6gq 2 роки тому +1

    Hey @codecat15, can you please tell which closure (escaping/non-escaping) can cause retain cycles, or both of them can cause it.

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

      Closures don’t cause retain cycles its how we implement them, a good practice is to use weak self to avoid cycles

  • @chetanaggarwal119
    @chetanaggarwal119 3 роки тому

    Question - if we have closure as stored property then is it escaping or non escaping? And Why?

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

    Please come up with completion block in swift

  • @ravneetsingh8790
    @ravneetsingh8790 Рік тому +1

    Sir if I want to call an api in the escaping closure in some file and when api ends its execution then I want to return the data to another ViewController and put that data on the label of that viewController on the time of screen appears.
    Please help me on this I am so frustrated due to this.

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

      you would have to call the api in that view controller let's call it ViewController A in the VC-A you will find a method called as viewWillAppear in that method make the API call and once you get the data, reload the label in the main queue. Please refer to my API playlist over there I have few examples of this and if that does not help please ping on my discord server iOS Cafe

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

    Sir, can please upload escaping closure with one easy example

  • @roh9934
    @roh9934 Рік тому +1

    bhai @escaping closure mai phle baaki sara code chalega fir closure ke andar wala?

  • @sumitrathore8446
    @sumitrathore8446 Рік тому +1

    So it means in escaping closure: function will call first then closure will call and in non escaping closure : closure will call first then function will call?

    • @CodeCat15
      @CodeCat15  Рік тому +1

      yes that's correct, think of escaping as a function hook, the escaping closure carries out it's business in a separate thread and then returns back the information to the same function where it was called

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

    enum in swift where and what use ? video

  • @runkushanthkumar22
    @runkushanthkumar22 4 роки тому +1

    hi please make a video on, how to save server data in core data?

    • @CodeCat15
      @CodeCat15  4 роки тому

      Hey there @Runku welcome to the channel, i just released a video on the basics of core data do check that out and in the core data series this is indeed one topic which i will cover in the coming days. If you have any question on closure or even core data please do feel free to ask and do share this channel with your iOS group on WhatsApp or Facebook

  • @nainasoni7831
    @nainasoni7831 4 роки тому +3

    thumbs-up (y)

  • @vyankateshshivnikar7932
    @vyankateshshivnikar7932 2 роки тому +2

    Video is really very informative but how adding the closure changed the sequence of execution? Need some more clarification on that.

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

      what do you think could be the reason for this?

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

      @@CodeCat15 The name closure which is used in code is non-escaping so not able to figure out how the sequence got changed....

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

      If you would have used escaping closure instead of that then the it will check if condition at first and then it will implement the closure part but default one is non escaping which is name so not able to figure it out...Please clear my doubt here...

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

      or may be because if we pass closure as a parameter in a function then we can add functionalities in a function call so we called assignName in function call.So it called the goodmorning function first checked boolean value and then called assignName as per boolean value.

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

      @@CodeCat15 We are checking the isMorning condition first and then calling the closure name() there..Is that the reason?

  • @kurbanalimasu4895
    @kurbanalimasu4895 3 роки тому +1

    Sir can you please explain more in escaping closure. Please try to explain with realtime example like fetch images from Firebase.

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      Sure, in the api series we made a httpUtility where we are using the escaping closure to return the decoded object from the api. Here’s the link to that video do check it out and let me know if you still have questions.
      Link: ua-cam.com/video/pnMip8Gpa0w/v-deo.html

    • @kurbanalimasu4895
      @kurbanalimasu4895 3 роки тому +1

      @@CodeCat15 Thanks a lot Sir...! I will sure ask if i will have any questions.

  • @akashviet007
    @akashviet007 Рік тому +1

    Is escaping/non-escaping is same concept as C# has async/await?

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

      No, escaping and non-escaping closures in Swift programming language are not the same as async/await in C#.
      In Swift, an escaping closure is a closure can be executed at a later time, even after the function has returned.
      A non-escaping closure in Swift is a closure that is executed within the function's scope and doesn't outlive the function itself.
      In C#, async/await is used to write asynchronous code that allows tasks to be executed concurrently without blocking the main thread.
      They are different concepts and have different syntax and usage in their respective programming languages.

  • @HirenMistry0125
    @HirenMistry0125 4 роки тому +1

    Hello!
    We use different UI objects like button label, as well as controllers like navigation controller, view controllers, table view controllers, etc
    So my question is
    How do we know which method or function we should use for a particular UI object or controller?
    For example, a navigation controller has many methods, how we know which method is suitable for a particular thing.
    In other words,
    there are so many inbuilt methods and properties.
    so my question is, how we know when which method or property should use, how to the parameter we can pass to a custom method.
    please help !

    • @CodeCat15
      @CodeCat15  4 роки тому +1

      I think for this you have to practice a lot, and go through the developer documentation and spend time with the system, the more you practice the more you become aware of the core functioning of the system and the do's and don't.
      SwiftUI is new so there are tons of new features apple added, few of them I know, but then few are complete revamp from how things were done in UIKit so I read the documentation, blogs or some StackOverflow answers but to be honest, practice has always been the most crucial element in learning and understanding anything.

    • @HirenMistry0125
      @HirenMistry0125 4 роки тому +1

      @@CodeCat15 Agree! Definitely, a lot of practice is required. (I thought there may be a technique to use a particular method ;), so I asked the question)
      BTW, can you please make a video on how to read/Use apple's developer documentation with example (because like me many other beginners have much difficulty to find particular method in apple's developer documentation)

    • @CodeCat15
      @CodeCat15  4 роки тому

      Yeah i agree the apple dev documentation sometimes appear to be very cryptic, but for swift my first stop is swift.org which explains with pretty good examples however the ui documentation is a different story and has less examples, will try and cover that in some of my videos

  • @praveenbishnoi2292
    @praveenbishnoi2292 3 роки тому +1

    Hello bro.. Your cliping is very helpful. I have a query if you will have time so Pls response me..
    Q. How's working process of automic and nonatomic?

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      Hello Praveen welcome to the channel, Atomic and non atomic are objective c parts, however they were used for threading where atomic was thread safe and non atomic was not thread safe.
      Recently in swift 5.3 apple has added atomic property wrapper which are like objective c atomic property and am going to release a video on that soon.

    • @praveenbishnoi2292
      @praveenbishnoi2292 3 роки тому +1

      Thank bro.. I'll wait for next video

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

    escaping clouser ke liye koi achha video pleause

  • @harshitjain7428
    @harshitjain7428 3 роки тому +1

    Can anyone please tell me how come name:() represent the closure?

    • @CodeCat15
      @CodeCat15  3 роки тому

      the name that you see is just used for reference purpose i.e. how declaring a closure or type alias for closure is pretty similar to declaring a variable.

  • @HirenMistry0125
    @HirenMistry0125 4 роки тому +1

    i have write a code like below to test
    func demoFunc(number:Int,closureNames:(Int,Int) -> Int {
    print("\(number)")
    print(closureNames(30,50)
    }
    demoFunc (number:10,closureName:{
    (a:Int,b:Int) -> Int in
    return a + b
    }
    it shows output 80,but
    when i use @autoclosure like below - it shows error
    func demoFunc(number:Int,closureNames:@autoclosure(Int,Int) -> Int {
    print("\(number)")
    print(closureNames(30,50)
    }
    i want to know why it hows error, cant we pass two arguments using @autclosure?

    • @CodeCat15
      @CodeCat15  4 роки тому +1

      let me start by saying this that autoclosures should not be used at all because they hide implementation details which I also mentioned in the video. Autoclosure cannot be used with parameters so even if you write the code as
      func doSomething(myClosure:@autoclosure(Int) -> Int)
      the compiler will raise a compile time error, you will hardly come across a use case in programming where you want to use autoclosure, and even apple recommends not to overuse them. Hope I was able to clarify your question if not then please do ask

    • @HirenMistry0125
      @HirenMistry0125 4 роки тому +1

      @@CodeCat15 yeah! Understood. Thank You

    • @CodeCat15
      @CodeCat15  4 роки тому +1

      If there are any more questions plz feel free to ask i will be happy to answer them and do share this video with your iOS group 😊

  • @AnkitSoni30
    @AnkitSoni30 4 роки тому +2

    Please make an Interview Q&A series.

    • @CodeCat15
      @CodeCat15  4 роки тому +1

      You know i have thought about it a lot to have my own interview series and i surely will release it in the coming days, how do you want the video to be like do you want me to explain the answers or just generally go with the questions that i ask?

    • @rj007love
      @rj007love 3 роки тому

      @@CodeCat15 We would love to know the approach not full answers. Thanks in advance waiting for interview video.

  • @zulqarnainpatel1988
    @zulqarnainpatel1988 3 роки тому +1

    Please in thumbnail add video number, it's getting hard to find the sequence. else provide sequence on any social platform I will check from there.

    • @CodeCat15
      @CodeCat15  3 роки тому

      So adding the video numbers was a bad idea from my end, i will be skipping video number from now on, sorry about the confusion buddy. If you are looking for the sequence then I request you to checkout the playlist section where videos are arranged in their respective sequence.

  • @AliHaider-wu2eb
    @AliHaider-wu2eb 4 роки тому +1

    make a video on MVP please

    • @CodeCat15
      @CodeCat15  4 роки тому

      are you using MVP pattern in your project? That's nice actually, what was the technical decision that made you choose MVP and not MVC if you can share this.

    • @AliHaider-wu2eb
      @AliHaider-wu2eb 4 роки тому

      No I am making my project based on MVC , but I want to know about MVP.

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

    please explain escaping and non escaping closures more clearly

  • @saravananraju528
    @saravananraju528 3 роки тому +1

    Explain [weak self] and [unowned self ] in closure?

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      I think i have explained the [weak self] portion in the delegate closure video do check that out
      Link: ua-cam.com/video/UafLiRvBwNA/v-deo.html
      However unowned self is something that i have not explained so let me work on that, thanks for making this request Saravanan and welcome to the channel 😊

  • @anitasingh-id2jt
    @anitasingh-id2jt 3 роки тому +1

    sir, escaping closure is not very clear to me please make a simple video for this and please be a little slow you are very fast.

    • @CodeCat15
      @CodeCat15  3 роки тому

      Sorry about the speech Anita, I was still very new to UA-cam. Escaping closures help us to return values from any background operations. URLSession calls an api in the background and when it has a response you return the response using the @escaping. By using @escaping you tell swift that there’s a background task which will return a value and use this @escaping closure to return me the value. Hope that covers it and if not feel free to let me know and I will try covering this in a blog or video for the same.

  • @govindsuryawanshi9052
    @govindsuryawanshi9052 3 роки тому +1

    May i know where are the API series related Videos ?

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      Here you go Govind
      Api series playlist: ua-cam.com/play/PLb5R4QC2DtFuXr4177KQ2lIXOkqwq97a4.html

    • @govindsuryawanshi9052
      @govindsuryawanshi9052 3 роки тому +1

      @@CodeCat15 Thank you so much for sharing and quick response...!

  • @natureloverspakistan
    @natureloverspakistan 3 роки тому +1

    by using closures .. increase chances of memory leaks? is it true

    • @natureloverspakistan
      @natureloverspakistan 3 роки тому +1

      what you say about type alias and lazy var for memory leaks?

    • @CodeCat15
      @CodeCat15  3 роки тому

      No that’s not true at all, closure don’t cause memory issues unless the code we write is incorrect like we fail to use [weak self] in closure as i explained in the delegate pattern video using closure.

    • @CodeCat15
      @CodeCat15  3 роки тому +1

      I will find it strange that a typealias or lazy could cause any leaks but unless i see the code l won’t comment on it coz mostly it depends on how the developer is using them, but in theory they should not cause any leaks unless the underlying implementation is not done right.

    • @natureloverspakistan
      @natureloverspakistan 3 роки тому

      @@CodeCat15 i had an interview why lead Developer , he told me that but typalias and lazy variables are causing memory leaks in some cases. but i didn't perform testing yet

    • @CodeCat15
      @CodeCat15  3 роки тому

      Let me give you an example agar insaan ko bukhar hai to doctor usse body pain ki davai to nahi dega,
      Doctor pata karengaye ki bimari kya hai aur us hisaab se davai dega,
      Kuch creative doctors galat davai de sakte hai bina koi test kiye, aur galat davai dene se kya hoga ye to aap jaante ho.
      when a dev tells me that its a leak coz of lazy or any other thing then i would ask him proof and some data matrix which proves that the leak is coz of the lazy variable or anything else, in programming we cannot assume things and hence we need proof or some test cases or instrument debugging to prove the origin of leak
      Varna pata chala leak kisi aur code ki vajaha se ho raha hai aur aap koi dusra code fix kar rahe ho, aise assumption basis pe kaam karogaye to aapka time waste hoga aur kuch nahi so ask the dev proof and origin of the leak.
      Hope it helps 😄

  • @makemytime9103
    @makemytime9103 4 роки тому +3

    if you do it little slower its more better. than .. this.. its getting over .. I have to watch it again and again.. to get it
    you can type code faster but make that sense or understanding for that code slower.. so that everything will be clear..
    its getting complex .. You spoked too fast.. this this this this..
    I found you video is best over others. ,,you but you spoiling it understanding ...

    • @CodeCat15
      @CodeCat15  4 роки тому

      I want to apologize for speaking too fast, I will work on it and be better next time. I really appreciate the feedback it means a lot. If there’s something else which i can improve and be better then please do tell

    • @vilas18able
      @vilas18able 4 роки тому +2

      My advice if not taken in the wrong way, I hope there is always have a speed control playback speed 0.25x, .5x, .75 x and this should ease the problem for viewers and vlogger.

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

    kanger