AppleSignIn is the fast and easy way to implement Sign in with Apple introduced on Apple WWDC 2019.
- Initialization
Sign in with Applebutton from code. - Initialization
Sign in with Applefrom storyboard or xib. - Login with
defaultbutton. - Login with
custombutton. - Add
MacOSsupport. - Add
WatchOSsupport. - Add
Cocoapodssupport. - Add
Cartagesupport.
- iOS 13.0+
- Xcode 11.0+
- Swift 5+
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate AppleSignIn into your Xcode project using CocoaPods, specify it in your Podfile:
pod 'AppleSignIn'Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate AppleSignIn into your Xcode project using Carthage, specify it in your Cartfile:
github "AntonReality/AppleSignIn" "0.0.1"
If you prefer not to use any of the dependency mentioned above, you can integrate AppleSignIn into your project manually. Just drag & drop the Sources folder to your project.
Pre-requirments:
- Set your development team in the Signing & Capabilities tab so Xcode can create a provisioning profile that uses the Sign In with Apple capability.
- Add Sign In with Apple capability.
- Choose a target device that you’re signed into with an Apple ID that uses Two-Factor Authentication.
import AppleSignIn
let button = AppleLoginButton()
button.delegate = self
view.addSubview(button)Implement delegate methods to receive user and handle errors.
func didCompleteAuthorizationWith(user: AppleUser) {
// Do any additional stuff with your backend.
}
func didCompleteAuthorizationWith(error: Error) {
// Handle error.
}import AppleSignIn
guard let window = view.window else { return }
let appleLoginManager = AppleLoginManager()
appleLoginManager.delegate = self
appleLoginManager.performAppleLoginRequest(in: window)performAppleLoginRequest requires to specify window where Apple Sign In screen should be presented.
Implement delegate methods to receive user and handle errors.
func didCompleteAuthorizationWith(user: AppleUser) {
// Do any additional stuff with your backend.
}
func didCompleteAuthorizationWith(error: Error) {
// Handle error.
}Easy right? For more details check ExampleProject.
Feel free to add your comments/commits/pull requests. Any additional help is appreciated.
AppleSignIn is released under the MIT license. See LICENSE for details.