Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apple/Nullable value #27

Merged
merged 2 commits into from
May 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Address PR comment.
  • Loading branch information
borut-t committed May 14, 2024
commit ef38881431b8edcbd76b4cb4fda1edd76ccde89f
14 changes: 9 additions & 5 deletions Sources/Apple/AppleAuthenticator+Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
}
}

Expand Down
Loading