'async' call cannot occur in a global variable initializer

(New to Swift but not AWS)

Get started with the SDK for Swift - AWS SDK for Swift says use this

let output = try await client.listBuckets(
    input: ListBucketsInput()

which results in 'async' call cannot occur in a global variable initializer

If you think about it, in what state should that variable be before it's asynchronously initialized? What would be its value?

While this would be acceptable in dynamic languages where variables assume some sort of an undefined state by default, strongly typed languages can't do that.

Best you can do I think is declare this variable as Optional of whatever type listBuckets() returns and initialize it elsewhere in an async context.

P.S. important to add that what you need would work within a function but not in the global scope.

Thanks. I need a lot more studying before I proceed with this.