Posts Run asynchronous task in SwifUI when view appears
Post
Cancel

Run asynchronous task in SwifUI when view appears

We may come across use cases where we need to load data asynchronously when a view appears. SwiftUI introduced task(_:) modifier in iOS 15 that provides an option to run an asynchronous task when the view appears and cancels it once the view disappears.

1
This post is licensed under CC BY 4.0 by the author.