Search code examples
iosswiftapple-sign-in

How to check an email address is whether Apple's private email or an actual email


I'm working on an iOS Swift project in which i have implemented Sign in with Apple. But when user tries to Sign in with Apples, its ask to share email or hide email. If it is share means it will return actual email and if it is hide means it returns to some private emails like

<unique-alphanumeric-string>@privaterelay.appleid.com

But is there any way to check whether the returned email is an actual user's email or its Apples private email?


Solution

  • By example:

    let email = "[email protected]"
    let isApplePrivateEmailAddress = email.hasSuffix("@privaterelay.appleid.com")