Add Sign in with Apple login page#40
Draft
muvaf wants to merge 2 commits into
Draft
Conversation
Adds a SwiftUI login experience that uses ASAuthorizationAppleIDProvider via SignInWithAppleButton. The app now shows LoginView when signed out and SignedInView (with name/email/user ID and a sign-out button) once an Apple credential has been returned. AuthState persists the user identifier (and any returned name/email) in UserDefaults. Also enables the Sign in with Apple capability by adding sample-native-app.entitlements and wiring CODE_SIGN_ENTITLEMENTS into both Debug and Release build configurations. Co-authored-by: muvaffak <me@muvaf.com>
- Add explicit 'import Combine' so AuthState's @published / ObservableObject resolve under the project's MemberImportVisibility upcoming feature; without this the build fails with 'AuthState does not conform to ObservableObject'. - Bump LoginView's bottom inset so the two-line Terms of Service / Privacy Policy footer stays clear of the home indicator. Co-authored-by: muvaffak <me@muvaf.com>
|
Limrun Preview
Reviewer must be a member of the organization on Limrun. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements a Sign in with Apple login experience for the sample iOS app.
When the app launches signed-out, the user lands on a custom dark-gradient
LoginViewfeaturing the Apple logo, a "Welcome" headline, a subtitle, the systemSignInWithAppleButton, and a Terms of Service / Privacy Policy footer. Tapping the button invokes the standardASAuthorizationAppleIDProviderflow; on success the app routes toSignedInView, which displays the returned name / email / user ID and offers a Sign Out action that returns to the login page.Changes
sample-native-app/AuthState.swift–ObservableObjectthat holds the current user's identifier, full name and email, persists them inUserDefaults, and exposessignIn/signOut/setError. (Apple only returns name + email on the very first authorization, so subsequent sign-ins do not overwrite cached values withnil.)sample-native-app/LoginView.swift– SwiftUI login screen usingAuthenticationServices.SignInWithAppleButton. Real failures are surfaced as an in-app error banner; user-canceled /.unknownASAuthorizationErrorcodes (what the simulator returns when the sheet is dismissed) are swallowed so the user does not see a confusing red banner.sample-native-app/SignedInView.swift– Post-sign-in screen showing name / email / user ID and a Sign Out button.sample-native-app/ContentView.swift/sample_native_appApp.swift– InjectAuthStateas an environment object and switch between login and signed-in views.sample-native-app/sample-native-app.entitlements– Addscom.apple.developer.applesignin = ["Default"], withCODE_SIGN_ENTITLEMENTSwired into both Debug and Release configurations inproject.pbxproj.Verification
Built and ran on a Limrun iOS simulator (
lim xcode build .):.unknownerror is intentionally filtered out).Login page
Sign in with Apple login page
Walkthrough video
login_page_walkthrough.mp4
Preview link
Open in Limrun simulator
To show artifacts inline, enable in settings.
Linear Issue: LIM-277