Task: try or no try
Liang Wang
Posted on January 29, 2024
In the ContentView I have this modifier added to fetch data:
.task {
await viewModel.fetchData()
}
It works great! But if I accidentally added a try
before await
, Xcode will complain about Invalid conversion from throwing function of type '@Sendable () async throws -> ()' to non-throwing function type '@Sendable () async -> Void'
Don't try
if it is NOT needed.
💖 💪 🙅 🚩
Liang Wang
Posted on January 29, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
githubcopilot AI Innovations at Microsoft Ignite 2024 What You Need to Know (Part 2)
November 29, 2024