Closures In Swift | @escaping and non-escaping completion handlers | in Urdu

  Рет қаралды 97

SWIFTLY CODING

SWIFTLY CODING

Күн бұрын

#Closures-In-Swift|@escaping-and-non-escaping-completion-handlers|in-Urdu
1: When to use #closures ?
Asynchronous code: Closures are often used to handle asynchronous operations, such as network requests or file I/O. By using closures, you can specify what should happen when the operation completes, without having to block the main thread.
Sorting and filtering: Closures can be used to sort or filter arrays or other collections based on specific criteria. This can be particularly useful when dealing with complex data types or when sorting or filtering needs to be done dynamically at runtime.
Callbacks: Closures can be passed as parameters to functions or methods and used as callbacks to handle events or respond to user actions. This can be useful in many different types of applications, from mobile apps to web services.
Capturing values: Closures can capture and manipulate variables from their surrounding context. This can be useful when you need to modify or access variables that are outside the scope of the closure.
2 : Difference between #escaping and #nonescaping completion handlers.
A completion handler, on the other hand, is a specific type of closure that is used to notify the caller of an asynchronous operation when it is complete. A completion handler is typically passed as a parameter to an asynchronous function, and is called when the function has finished its work.
#swift #forbeginners #callbacks @escaping, @non-escaping, completion handlers

Пікірлер: 4
@AllahMuhammad_786
@AllahMuhammad_786 Жыл бұрын
😮
@zaidafzal9208
@zaidafzal9208 Жыл бұрын
Github Project Link : github.com/ZaidAhmad2468/Closures-In-Swift
@UsmanKhanLodhi3
@UsmanKhanLodhi3 Жыл бұрын
Can you please create a video explaining the iOS learning road map. It would be highly appreciated. ❤
@zaidafzal9208
@zaidafzal9208 Жыл бұрын
Sure, I will create a video on explaining iOS learning road map.
Swift Closures Explained
14:23
Sean Allen
Рет қаралды 66 М.
Demystifying Completion Handlers and Asynchronous Functions
19:03
Stewart Lynch
Рет қаралды 3,9 М.
怎么能插队呢!#火影忍者 #佐助 #家庭
00:12
火影忍者一家
Рет қаралды 38 МЛН
Mom had to stand up for the whole family!❤️😍😁
00:39
Don't look down on anyone#devil  #lilith  #funny  #shorts
00:12
Devil Lilith
Рет қаралды 47 МЛН
Workshop on AI and API | Hackathon - United Group Presents BUET CSE Fest 2024
2:01:43
Swift - escaping & non escaping Closures
7:22
iOS Solves
Рет қаралды 1,9 М.
First look at Signals in Angular
18:43
Decoded Frontend
Рет қаралды 45 М.
Lecture 6: Version Control (git) (2020)
1:25:00
Missing Semester
Рет қаралды 680 М.
How To Easily Do Asynchronous Programming With Asyncio In Python
23:09
Lazy property in Swift  || iOS interview Questions
9:19
App Developer
Рет қаралды 3 М.
怎么能插队呢!#火影忍者 #佐助 #家庭
00:12
火影忍者一家
Рет қаралды 38 МЛН