Coder Social home page Coder Social logo

applesignin's Introduction

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.

applesignin's People

Contributors

antonreality avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.