Skip to content

Commit

Permalink
Expose PersonNameComponents for AppleSignIn
Browse files Browse the repository at this point in the history
  • Loading branch information
yllfejziu committed Apr 29, 2024
1 parent 3c0244c commit 2ba9405
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions Sources/Apple/AppleAuthenticator+Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ public extension AppleAuthenticator {
public let userId: String
public let token: String
public let authCode: String
public let name: String?
public let name: PersonNameComponents?
public let email: Email
public let expiresAt: Date

public var displayName: String {
[name?.givenName, name?.familyName]
.compactMap { $0 }
.joined(separator: " ")
}
}

enum Error: Swift.Error {
Expand All @@ -43,11 +49,3 @@ public extension AppleAuthenticator.Response {
public let isVerified: Bool
}
}

extension ASAuthorizationAppleIDCredential {
var displayName: String {
[fullName?.givenName, fullName?.familyName]
.compactMap { $0 }
.joined(separator: " ")
}
}
2 changes: 1 addition & 1 deletion Sources/Apple/AppleAuthenticator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ extension AppleAuthenticator: ASAuthorizationControllerDelegate {
let response = Response(userId: credential.user,
token: identityTokenString,
authCode: authCode,
name: credential.displayName,
name: credential.fullName,
email: email,
expiresAt: expiresAt)

Expand Down

0 comments on commit 2ba9405

Please sign in to comment.