@@swifttutorialsforios Thanks. In a real life analogy, is asychronous analgous to a gantt chart or say a chef frying something and while waiting for that to finish, he is chopping vegetables? Or are these two example analogous to synchronous?
For example of real life suppose chef is heating oil in the pan, he starts chopping vegetable till oil heats up. This is asynchronous call as both task are not blocking each other. Thus if you want you use closure in this case you will say as soon as choping vegetables are done, we will put vegetables in oil.
Hi brother.. Really such a needling tutorial when you explained and compared it with function... I was struggling to understand it.. Thank you brother..and finally . Subscribed...
when the closure passed as last parameter in a function (if that function has many parameters) called outside of the function . then that closure treated as trailing closure.
Thats not mandatory but it depends upon the requirement. Closures are useful because 1) easy readability 2) no need to remeber the reference for object for which closure gets called ( example suppose in tableview list you need to get name according to lat long from api. So if you use closures then its easy to set name for lable as the refrencw of each closures call is associated with the calling cell and in case of function you need to put a check to detect for which cell you fetch the name)
New subscriber here.
Thanks for subbing
Finally I understood Closures ! Thank you so much !!!
Cool thanks, are closures just used as an argument for a function that has a parameter of a closure?
Yes, as most of the times they are associated like a completion handler, so that one can gets response or compiler attention during asynchronous call.
@@swifttutorialsforios Thanks. What's an example of a synchronous call?
Normalnfunctioms likenassigning image to UiImageview or text to uilable are examole of synchronous call
@@swifttutorialsforios Thanks. In a real life analogy, is asychronous analgous to a gantt chart or say a chef frying something and while waiting for that to finish, he is chopping vegetables? Or are these two example analogous to synchronous?
For example of real life suppose chef is heating oil in the pan, he starts chopping vegetable till oil heats up. This is asynchronous call as both task are not blocking each other. Thus if you want you use closure in this case you will say as soon as choping vegetables are done, we will put vegetables in oil.
That is the best explanation I have got by far - thank you so very much!!
thanks a lot finally
It is too good..plz share how to develop maps in IOS using mapkit and find track line between two locations..
Nice!
Closure as a completion handler Explain Please?
Ok, will create a video sooner on this.
when we use closure instead of function and why?
In certain tasks where you does not the execution time or response back time, these are the cases where you need to use closures.
@@swifttutorialsforios can you explain it with the help of example.
Ok, i will try to make a video on same.
What is the escaping and non Escaping closures when to use these
Hi brother.. Really such a needling tutorial when you explained and compared it with function... I was struggling to understand it.. Thank you brother..and finally . Subscribed...
Hi, Nice tutorial. If possible can you upload database with dynamic data in swift.
Thanks for the feedback. Will try to create one video with same topic as soon as we can. Thank you
thank you.
What is trailing closure?
Swift Tutorials can you please make a tutorial on it.
when the closure passed as last parameter in a function (if that function has many parameters) called outside of the function . then that closure treated as trailing closure.
Can u explain why use closure instead of functions.
Thats not mandatory but it depends upon the requirement. Closures are useful because
1) easy readability
2) no need to remeber the reference for object for which closure gets called ( example suppose in tableview list you need to get name according to lat long from api. So if you use closures then its easy to set name for lable as the refrencw of each closures call is associated with the calling cell and in case of function you need to put a check to detect for which cell you fetch the name)