await call in didSet block

How can we call async functions in did set blocks? This code will trigger a compilation error: 'didSet' accessor cannot have specifier 'async'

   @Published var lastLocation: CLLocation? {
        didSet async {
                await pinPosition()
        }
    }

I just figured it out that it works like this:

didSet {
       async {
                await pinPosition()
        }
}

Since async is getting deprecated there, you can use Task!

 didSet {
  Task {
    await pinPosition()
  }
}
await call in didSet block
 
 
Q