<BlockSwitcher>

<Block name="Async/Await">

```swift
func fetchCurrentAuthSession() async {
    do {
        let session = try await Amplify.Auth.fetchAuthSession() 
        print("Is user signed in - \(session.isSignedIn)")
    } catch let error as AuthError {
        print("Fetch session failed with error \(error)")
    } catch {
        print("Unexpected error: \(error)")
    }
}
```

</Block>

<Block name="Combine">

```swift
func fetchCurrentAuthSession() -> AnyCancellable {
    Amplify.Publisher.create {
            try await Amplify.Auth.fetchAuthSession()
        }.sink {
            if case let .failure(authError) = $0 {
                print("Fetch session failed with error \(authError)")
            }
        }
        receiveValue: { session in
            print("Is user signed in - \(session.isSignedIn)")
        }
}
```

</Block>

</BlockSwitcher>
