Swift: OnReady Design Pattern (2021, Xcode 12, iOS) - iOS Development

preview_player
Показать описание
In this video we will learn about the when ready and on ready design patterns in Swift and iOS. Commonly used for async operations, this pattern lets your code be both flexible and reusable. We'll work in Xcode 12 and Swift 5.

#swift #designPattern #iOS

** Popular Series

** Get Skillshare free for 2 Months and learn iOS

** Manage all your investments from app earnings on Betterment!

** Grow your own Youtube tech channel with TubeBuddy:
Рекомендации по теме
Комментарии
Автор

this channel definitely deserves more subs, thank you sir. I am your fan from Taiwan and have learnt a lot from you.
just wanna appreciate you spending your spare time to do all of these invaluable video.

raychen
Автор

Thanks for sharing, it's very useful
we can use "for (index, element)" at the end

trungnghia
Автор

Can I put permanent like on this YouTube channel?

evgenykravtsov
Автор

Is it possible to get the string if we pass it in our getdata function?

class Singleton {

static let shared = Singleton()

private var isReady:Bool = false

typealias completionHandler = ((String) -> Void)

var arrOfCompletionContext: [completionHandler] = []

func warmingUp() {
print("I am warming up")
.now() + 5) {
self.isReady = true
{ context in
<#String#>, completion: context)
}
}
}

func mainExercise(str: String, completion: @escaping completionHandler ) {
if isReady {
completion(str)
} else {

}
}
}

let instance = Singleton.shared
instance.warmingUp()
instance.mainExercise(str: "ABC") { str in
print(str)
}

fitdevelopertv