```swift func fetchAttributes() { Amplify.Auth.fetchUserAttributes() { result in switch result { case .success(let attributes): print("User attributes - \(attributes)") case .failure(let error): print("Fetching user attributes failed with error \(error)") } } } ``` ```swift func fetchAttributes() -> AnyCancellable { Amplify.Auth.fetchUserAttributes() .resultPublisher .sink { if case let .failure(authError) = $0 { print("Fetch user attributes failed with error \(authError)") } } receiveValue: { attributes in print("User attributes - \(attributes)") } } ```