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 all commits
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
15 changes: 10 additions & 5 deletions Sources/Apple/AppleAuthenticator+Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ public extension AppleAuthenticator {
public let nameComponents: PersonNameComponents?
public let email: Email
public let expiresAt: Date

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

/// User full name represented by `givenName` and `familyName`
public var name: String? {
guard let givenName = nameComponents?.givenName else {
return nameComponents?.familyName
}
guard let familyName = nameComponents?.familyName else {
return givenName
}
return "\(givenName) \(familyName)"
}
}

Expand Down
Loading