diff --git a/Sources/Apple/AppleAuthenticator+Models.swift b/Sources/Apple/AppleAuthenticator+Models.swift index 22514d6..935eb49 100644 --- a/Sources/Apple/AppleAuthenticator+Models.swift +++ b/Sources/Apple/AppleAuthenticator+Models.swift @@ -22,12 +22,16 @@ public extension AppleAuthenticator { public let nameComponents: PersonNameComponents? public let email: Email public let expiresAt: Date - + + /// User full name represented by `givenName` and `familyName` public var name: String? { - let fullName = [nameComponents?.givenName, nameComponents?.familyName] - .compactMap { $0 } - .joined(separator: " ") - return !fullName.isEmpty ? fullName : nil + guard let givenName = nameComponents?.givenName else { + return nameComponents?.familyName + } + guard let familyName = nameComponents?.familyName else { + return givenName + } + return "\(givenName) \(familyName)" } }