How to Use ASAuthorizationAppleIDButton in Storyboard

Make it fully customisable with IBInspectable and IBDesignable

Lee Kah Seng
The Startup

--

How to Use ASAuthorizationAppleIDButton in Storyboard

At WWDC 2019, Apple introduced Sign in with Apple. It provides a simple and secure way for people to sign in to apps using the Apple IDs they already have. In order to support Sign in with Apple, developers must use the sign in button provided by Apple — ASAuthorizationAppleIDButton.

Unfortunately, the ASAuthorizationAppleIDButton class does not have storyboard support. Therefore, developers will have to add the sign in button programmatically, causing them not able to enjoy the benefits of using storyboards.

The benefits of using storyboards include:

  • Can easily setup auto layout constraints.
  • Better visualisation on the overall screen design.
  • Much easier to handle various size classes.
  • Less code written means less bugs.

In this article, I will show you how you can use ASAuthorizationAppleIDButton in storyboard by using a custom UIButton.

Generally, here’s what you need to do.

  1. Create a custom UIButton.
  2. Add ASAuthorizationAppleIDButton as subview.
  3. Create IBInspectable for…

--

--

Lee Kah Seng
The Startup

Support me by becoming a Medium member: https://leekahseng.medium.com/membership ⦿ 🇲🇾 Creator of https://swiftsenpai.com ⦿ iOS developer since 2011