I have looked at Async quite a bit from many different sources. This explanation "hit me in the head" or was perfect for my understanding. Thanks for this new series - it is very timely for most of us!
Did @Escaping then Combine videos came. After several months Nick explains about Async & Await. And I'm like here we go again. hehe.. Awesome work as always Nick.
In my case when i call addAuther1() from onAppear it shows null in thread name following warning receives Class property 'current' is unavailable from asynchronous contexts; Thread.current cannot be used from async contexts.; this is an error in Swift 6
I have an error in 08:09, and it is called "Class property 'current' is unavailable from asynchronous contexts; Thread.current cannot be used from async contexts.; this is an error in Swift 6" What is it means?
Hi, Thanks a lot for your work! I have a question here. I called function addAuthor1() several times and I never get main thread as you have. What can be the problem here? Or is it some changes in swift concurrency?
Why will it not work on macOS? Even running on Catalyst does not show any images, it seems like the URLSession calls doesn't work. If I compile for iPad it is o.k. all three different ways.
NOTE: Class property 'current' is unavailable from asynchronous contexts; Thread.current cannot be used from async contexts.; this is an error in Swift 6 For the purpose of this tutorial the warning can be ignore, but you should avoid trying to get access to Thread.current in production. You can however still use thread.isMainThread
Hi Nick, thank you for another great video ! I saw that you can add @MainActor to your class so you don't need to specify it inside the functions, is it a good practice or not ?
The author has an error, we do not get into the main stream. line 37 - to be moved to await MainActor.body { } await MainActor.run(body: { let author2 = "Author2 : \(Thread.current)" self.dataArrat.append(author2) let author3 = "Author3 : \(Thread.current)" self.dataArrat.append(author3) })
I have looked at Async quite a bit from many different sources. This explanation "hit me in the head" or was perfect for my understanding. Thanks for this new series - it is very timely for most of us!
That cleared up a lot of my confusion about async await. Thanks for the extra level of detail by showing the current thread numbers.
Really easy to understand and useful.
super easily explained the topic
Did @Escaping then Combine videos came. After several months Nick explains about Async & Await. And I'm like here we go again. hehe.. Awesome work as always Nick.
thanks bro, this is great
helped me got rid of that purple warning
brother Nick, I am using Xcode 14 every time it goes background thread. for example, author1 or something 2 is in the background thread .
Simply fantastic simulation, awesome.
In my case when i call addAuther1() from onAppear it shows null in thread name following warning receives
Class property 'current' is unavailable from asynchronous contexts; Thread.current cannot be used from async contexts.; this is an error in Swift 6
same. Thread.current not available in async appaz
Great work!! Mind-blowing. Keep it up
I have an error in 08:09, and it is called "Class property 'current' is unavailable from asynchronous contexts; Thread.current cannot be used from async contexts.; this is an error in Swift 6"
What is it means?
use only Thread() instead of Thread. current.
@@emdutt4012 Thanks bro
Awesome Async!
If it possible you can update this for swift 6 and Observation Framework
Mybe Simplest Video but also quite Important one.
Hi, Thanks a lot for your work! I have a question here. I called function addAuthor1() several times and I never get main thread as you have. What can be the problem here? Or is it some changes in swift concurrency?
Me too. author1() always runs on the Main thread. Not sure why.
Same - seems like addAuthor1() runs on background thread by default
"If it doesn't work, I probably need a new job, but It did work" LOL... 😂😂😂😂😒😒😒
Very well explained!
Great explanation!
Is there a chance await hangs forever? Is there a timeout config?
well explained. thank you!
the best explanation! Thank you =)
Sorry still confused as to why author2 and something2 are in the background threads even though they are being ran in a MainActor?
Brilliant. Huge Help!
Love this explanation! More videos like this!
Thanks!
at 3:26, I laughed so hard on this hahahahaha ... great work Nick!
Best one I've seen
Why will it not work on macOS? Even running on Catalyst does not show any images, it seems like the URLSession calls doesn't work. If I compile for iPad it is o.k. all three different ways.
good quality tutorials!
Glad you like them!
Great job! 🙏
Class property 'current' is unavailable from asynchronous contexts; Thread.current cannot be used from async contexts.; this is an error in Swift 6
Awesome!!! Thank you so much.
Thanks!
Your Joke is always funny lol
NOTE: Class property 'current' is unavailable from asynchronous contexts; Thread.current cannot be used from async contexts.; this is an error in Swift 6
For the purpose of this tutorial the warning can be ignore, but you should avoid trying to get access to Thread.current in production. You can however still use thread.isMainThread
Hi Nick, thank you for another great video ! I saw that you can add @MainActor to your class so you don't need to specify it inside the functions, is it a good practice or not ?
Yea it is good practice, but depending on the situation. I have a whole video on GlobalActors and the @MainActor later in this series!
Task.sleep(for:tolerance:clock:) in iOS 16 is nicer than Task.sleep(nanoseconds:) in iOS 13.
.onAppear{ Task{ await viewModel.addAuthor1 No 'async' operations occur within 'await' expression What is going on? Please help
The author has an error, we do not get into the main stream.
line 37 - to be moved to await MainActor.body { }
await MainActor.run(body: {
let author2 = "Author2 : \(Thread.current)"
self.dataArrat.append(author2)
let author3 = "Author3 : \(Thread.current)"
self.dataArrat.append(author3)
})