Skip to content

Latest commit

 

History

History
120 lines (83 loc) · 3.76 KB

File metadata and controls

120 lines (83 loc) · 3.76 KB

CocoaPods Compatible Carthage Compatible Platform Facebook Open Source Helpers

AppleSignIn is the fast and easy way to implement Sign in with Apple introduced on Apple WWDC 2019.

Features

  • Initialization Sign in with Apple button from code.
  • Initialization Sign in with Apple from storyboard or xib.
  • Login with default button.
  • Login with custom button.
  • Add MacOS support.
  • Add WatchOS support.
  • Add Cocoapods support.
  • Add Cartage support.

Requirements

  • iOS 13.0+
  • Xcode 11.0+
  • Swift 5+

Installation

CocoaPods

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

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"

Manually

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.

Usage

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.

Adding Sign in with Apple with default button.

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.
}

Adding Sign in with Apple with a custom action/button.

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.
}

That's it!

Easy right? For more details check ExampleProject.

Contribution

Feel free to add your comments/commits/pull requests. Any additional help is appreciated.

License

AppleSignIn is released under the MIT license. See LICENSE for details.