Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
301 commits
Select commit Hold shift + click to select a range
c233113
fix: import twitter to allow sign-in
russellwheatley Oct 9, 2025
ef5f786
refactor: provider logic so it can be passed into button
russellwheatley Oct 10, 2025
ad137a0
fix: display name if email is unavailable, twitter sometimes user use…
russellwheatley Oct 10, 2025
4cb5f27
chore: use withTwitterSignIn() for test and content view
russellwheatley Oct 10, 2025
76e8ceb
feat: pass provider to providerWithUI
russellwheatley Oct 10, 2025
5283f65
fix: renamed arg to make it clear the distinction between provider & …
russellwheatley Oct 10, 2025
4dbd565
fix: make provider arg optional
russellwheatley Oct 10, 2025
1b6a295
feat: implement API for deleting Twitter user
russellwheatley Oct 10, 2025
7a37a33
fix: put delete function on the provider
russellwheatley Oct 10, 2025
ac7f146
format
russellwheatley Oct 10, 2025
94415ff
feat: Twitter sign-in button styling
russellwheatley Oct 10, 2025
cab823c
chore: change button name to "X"
russellwheatley Oct 10, 2025
854a506
test: sign in buttons are visible on auth picker
russellwheatley Oct 10, 2025
d1602f8
fix: sometimes email isn't available so use `as:` instead
russellwheatley Oct 10, 2025
4897996
fix: remove incorrect naming
russellwheatley Oct 10, 2025
855e40b
test: pass emulator argument
russellwheatley Oct 20, 2025
5259847
test: test setup should be from tests
russellwheatley Oct 20, 2025
a643720
test: refactor tests so setup occurs before running test runner
russellwheatley Oct 20, 2025
9c2255e
test: create test app function
russellwheatley Oct 20, 2025
d3d1f7b
test: remove duplicate test functions
russellwheatley Oct 20, 2025
0e0c4b7
ci: separate into 3 jobs so tests can easily be re-run
russellwheatley Oct 20, 2025
4a3eb71
ci: bump unit test timeout
russellwheatley Oct 20, 2025
193656d
Merge pull request #1276 from firebase/twitter-package
russellwheatley Oct 21, 2025
6fa2eab
refactor: google provider
russellwheatley Oct 10, 2025
8da6c91
refactor: facebook provider
russellwheatley Oct 10, 2025
c14ad31
refactor: phone auth provider
russellwheatley Oct 10, 2025
95fbb89
fix: cleaner approach to phone auth sign in
russellwheatley Oct 22, 2025
efbc028
format
russellwheatley Oct 22, 2025
2769e03
fix: phone auth is isolated within package
russellwheatley Oct 23, 2025
3a583ba
fix: remove createPhoneAuthCredential
russellwheatley Oct 23, 2025
747ba8a
fix: remove authservice from phone auth modal
russellwheatley Oct 23, 2025
2424b6c
format
russellwheatley Oct 23, 2025
e838597
Merge pull request #1277 from firebase/refactor-remaining-packages
russellwheatley Oct 23, 2025
d1f561c
feat: initial implementation of apple architecture
russellwheatley Oct 21, 2025
35d55ba
chore: setup package.swift with apple package
russellwheatley Oct 21, 2025
5ccebec
chore: import apple to test app
russellwheatley Oct 21, 2025
7f6be55
feat: support apple sign in
russellwheatley Oct 21, 2025
0cbc68e
chore: example app has apple sign in capability
russellwheatley Oct 21, 2025
d595a8b
fix: store pending credential to allow deletion of user
russellwheatley Oct 21, 2025
e92dc97
test: test the existence of apple button
russellwheatley Oct 21, 2025
ff554e4
fix: pass in apple scopes
russellwheatley Oct 21, 2025
cc56c75
Merge pull request #1278 from firebase/apple-provider
russellwheatley Oct 24, 2025
08cfd07
refactor: phone auth provider
russellwheatley Oct 10, 2025
c81680b
feat: initial OAuth setup
russellwheatley Oct 22, 2025
9493572
chore: setup test app with OAuth
russellwheatley Oct 22, 2025
6a43b96
chore: needed custom params for microsoft and yahoo
russellwheatley Oct 22, 2025
a2c8aa1
chore: remove linkedIn
russellwheatley Oct 22, 2025
44d07f8
format
russellwheatley Oct 22, 2025
10f89aa
chore: setup microsoft and yahoo sign in
russellwheatley Oct 22, 2025
058fc3e
test: test buttons are present in auth picker
russellwheatley Oct 22, 2025
08a4763
feat: use logos for microsoft, yahoo and github
russellwheatley Oct 22, 2025
5a72536
fix: remove duplicate provider
russellwheatley Oct 24, 2025
dd9e119
chore: update to use guards
russellwheatley Oct 24, 2025
a204161
ci: update timeouts
russellwheatley Oct 24, 2025
d09ff11
ci: update name of test results
russellwheatley Oct 24, 2025
f5d86be
ci: remove obsolete log for firebase logs
russellwheatley Oct 24, 2025
dbcf36d
ci: debug mode for logs
russellwheatley Oct 24, 2025
4f45eaf
test: test sometimes fails waiting for signed in screen so might be a…
russellwheatley Oct 24, 2025
4832ff7
Merge pull request #1279 from firebase/oauth-providers
russellwheatley Oct 24, 2025
d33e56f
feat: initial OAuth setup
russellwheatley Oct 22, 2025
0620f9c
refactor: use error alert modal to display errors
russellwheatley Oct 23, 2025
efee1af
chore: rename to updateError
russellwheatley Oct 23, 2025
33454f0
fix: updateError in authservice
russellwheatley Oct 23, 2025
af8a8de
refactor: ensure authservice updates error for modal
russellwheatley Oct 23, 2025
e07ef83
format
russellwheatley Oct 23, 2025
6dcf89e
chore: remove management of error from Views
russellwheatley Oct 23, 2025
82015bf
refactor: password recovery to use modal
russellwheatley Oct 23, 2025
8c3ce69
chore: remove note
russellwheatley Oct 23, 2025
fec75eb
fix: facebook error modal
russellwheatley Oct 24, 2025
a9ea643
fix: apple, google and twitter error modals
russellwheatley Oct 24, 2025
9e3219c
format
russellwheatley Oct 24, 2025
8a9019b
fix: update error for provider sign-in
russellwheatley Oct 24, 2025
2977922
test: error modal pops up for email + FB sign-in failure/cancel
russellwheatley Oct 24, 2025
a55d8dd
chore: use defer to remove duplicate code
russellwheatley Oct 27, 2025
66bc390
Merge pull request #1280 from firebase/error-refactor
russellwheatley Oct 27, 2025
91dffba
refactor: remove GoogleServiceError
russellwheatley Oct 27, 2025
56368ec
format
russellwheatley Oct 27, 2025
8696ca3
refactor: use AuthServiceError for all errors
russellwheatley Oct 27, 2025
a4b146a
fix: ensure Facebook limited or classic login occurs when selected
russellwheatley Oct 27, 2025
cda7c4c
Merge pull request #1281 from firebase/unified-auth-service-error
russellwheatley Oct 27, 2025
154e38f
Merge branch 'development' into fix-limited-login
russellwheatley Oct 27, 2025
cbed04a
refactor: remove AuthenticationToken as it is not needed
russellwheatley Oct 27, 2025
e643d78
Merge pull request #1282 from firebase/fix-limited-login
russellwheatley Oct 27, 2025
ad1f667
Merge pull request #1283 from firebase/remove-authentication-token
russellwheatley Oct 27, 2025
d698c29
ui changes
demolaf Oct 27, 2025
1028c7b
refactor: use the same reauthenticate method for providers with same …
russellwheatley Oct 27, 2025
2376da1
refactor: use the same protocol for account services
russellwheatley Oct 27, 2025
aaaf487
refactor: attempt to use one class
russellwheatley Oct 27, 2025
7c0537f
fx: make mainactor
russellwheatley Oct 27, 2025
1b14339
refactor: add phone auth to deleteUser + put in same protocol
russellwheatley Oct 27, 2025
894ff67
fix: providerId for phone
russellwheatley Oct 27, 2025
e7ada7a
fix: non sendable CI issue
russellwheatley Oct 28, 2025
d2521e2
chore: use swift v6 for example app
russellwheatley Oct 28, 2025
ed53347
fix: move mainactor
russellwheatley Oct 28, 2025
8e9b294
chore: move to swift 6
russellwheatley Oct 28, 2025
a81e9b6
feat: register library version for auth service usage
russellwheatley Oct 28, 2025
4821561
ci: update to use xcode 26
russellwheatley Oct 28, 2025
5d05bd3
ci: update iphone device
russellwheatley Oct 28, 2025
47b3a60
refactor: use provider styles
demolaf Oct 28, 2025
d5745c3
fix: move limited login to sample app
demolaf Oct 28, 2025
ef278eb
refactor: AuthPickerView layout and styling
demolaf Oct 28, 2025
94f1a36
refactor: use sheet and navigation links
demolaf Oct 29, 2025
598e918
test: use main thread for test helper functions
russellwheatley Oct 29, 2025
e17ee4d
fix: do not show error modal when MFA required
russellwheatley Oct 29, 2025
4803efa
Merge pull request #1286 from firebase/account-service
russellwheatley Oct 29, 2025
f86f7e0
Merge branch 'development' into tracking-usage
russellwheatley Oct 29, 2025
4a517a2
Merge branch 'development' into stop-error-modal-on-mfa-resolution
russellwheatley Oct 29, 2025
4f997f9
refactor: phone auth view and use navigation path instead
demolaf Oct 29, 2025
782eca1
Merge pull request #1289 from firebase/stop-error-modal-on-mfa-resolu…
russellwheatley Oct 29, 2025
2ceeb7a
add firebase auth logo
demolaf Oct 29, 2025
2a4f17a
chore: create release script for Swift packages
russellwheatley Oct 29, 2025
b32f11a
chore: update comment and add license header
russellwheatley Oct 29, 2025
a4c43be
Merge pull request #1287 from firebase/tracking-usage
russellwheatley Oct 29, 2025
edb8b73
fix: allow reauth on sensitive operations
russellwheatley Oct 30, 2025
a0a1435
refactor: cleaner and simpler reauth implementation
russellwheatley Oct 30, 2025
9744917
test: fix tests with MainActor annotation
russellwheatley Oct 30, 2025
046e936
refactor: remove obsolete deleteUser from every provider and AccountS…
russellwheatley Oct 30, 2025
ff8ff47
Merge pull request #1290 from firebase/reauth-mfa
russellwheatley Oct 30, 2025
61ae6dc
refactor: auto resolve limited login from ATT
demolaf Oct 30, 2025
d192d4e
fix: button for email link auth
demolaf Oct 30, 2025
ce4a146
Merge branch 'development' of https://github.com/firebase/FirebaseUI-…
demolaf Oct 30, 2025
cee4579
fix package.swift errors
demolaf Oct 30, 2025
265830c
refactor: handle auto upgrade anonymous improvement
russellwheatley Oct 30, 2025
a09e615
format
russellwheatley Oct 30, 2025
08eeaf6
Update samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExample/…
demolaf Oct 31, 2025
3259d7f
format
russellwheatley Oct 31, 2025
6846c4d
fix: remove duplicate back buttons
russellwheatley Oct 31, 2025
ebaeb87
fix: password recovery email button label
russellwheatley Oct 31, 2025
969a9da
fix: descriptive text of what it does
russellwheatley Oct 31, 2025
557a005
chore: add button to open authpickerview
russellwheatley Oct 31, 2025
c6469d7
chore: update SignedInView UI
russellwheatley Oct 31, 2025
c97bcec
chore: remove sign in title when authenticated
russellwheatley Oct 31, 2025
0825807
chore: remove "as"
russellwheatley Oct 31, 2025
c53cfcf
fix: update password view to match UI
russellwheatley Oct 31, 2025
4f6e0f3
fix: MFA management View UI fix
russellwheatley Oct 31, 2025
0e532d0
fix: mfa enrolment View
russellwheatley Oct 31, 2025
ad4a0f6
fix: mfa enrolment phone number
russellwheatley Oct 31, 2025
cf5a6cc
fix: ensure everything can fit on the page
russellwheatley Oct 31, 2025
815d8ca
fix: delete account confirmation sheet
russellwheatley Oct 31, 2025
7285f12
refactor: remove signedInCredential and used persisted tokenresult to…
russellwheatley Oct 31, 2025
ffc8436
refactor: send email view to match UI and remove surplus file
russellwheatley Oct 31, 2025
cd9f261
format
russellwheatley Oct 31, 2025
1550af0
refactor: improve sheet when email link sent
russellwheatley Oct 31, 2025
207f13d
update facebook brand logo
demolaf Nov 1, 2025
54d9b33
add sign in with LINE example
demolaf Nov 3, 2025
4066b13
use @bindable for binding observable objects
demolaf Nov 3, 2025
2a0dc03
chore: update TestView
russellwheatley Nov 3, 2025
669360d
test: fix up UI testa and format
russellwheatley Nov 3, 2025
eb6291a
test: UI runner updates
russellwheatley Nov 3, 2025
dfdbf44
test: fix more tests after UI refactor
russellwheatley Nov 3, 2025
ec83755
format
russellwheatley Nov 3, 2025
fd4d28b
test: mainactor annotations
russellwheatley Nov 3, 2025
06a3688
Merge pull request #1285 from demolaf/ui-updates
russellwheatley Nov 3, 2025
c072ad8
Merge branch 'development' into anonymous-upgrade
russellwheatley Nov 3, 2025
786bdd1
refactor: phone authentication
russellwheatley Nov 3, 2025
7820b56
fix: update cancel button
russellwheatley Nov 3, 2025
b87e17e
fix: silent error on cancel
russellwheatley Nov 3, 2025
3a71f54
format
russellwheatley Nov 3, 2025
836154b
Merge pull request #1291 from firebase/anonymous-upgrade
russellwheatley Nov 3, 2025
a0a5e77
feat: attempt re auth in Views if credential already exists
russellwheatley Nov 4, 2025
48d8076
chore: handle opinionated logic inside Views
russellwheatley Nov 4, 2025
c03321b
fix: flicks signed in view because there is "authenticating" state
russellwheatley Nov 4, 2025
3263f38
fix: silently link accounts when there's a conflict
russellwheatley Nov 4, 2025
d18752f
fix: anonymous upgrade, link accounts silently if possible
russellwheatley Nov 4, 2025
ee4784c
format
russellwheatley Nov 4, 2025
6d4e37c
feat: add spanish translations and optional logo param config
demolaf Nov 4, 2025
c4bd5fc
feat: optional logo and locale, es, de, fr translations
demolaf Nov 5, 2025
f796218
refactor: create method for throwing error with context
russellwheatley Nov 5, 2025
46cfaaa
fix: make currentError a binding
russellwheatley Nov 5, 2025
947f2d1
test: show email/password upgrades when anonymous user is signed in
russellwheatley Nov 5, 2025
d9e7b79
Merge pull request #1292 from firebase/account-exists-diff-credential
russellwheatley Nov 5, 2025
1d9d8dc
fix: just use onChange to stop flashes of different screens
russellwheatley Nov 5, 2025
1b7d17a
fix: remove setVerificationCode for phone auth
demolaf Nov 5, 2025
0fb6e66
Merge branch 'development' of https://github.com/firebase/FirebaseUI-…
demolaf Nov 5, 2025
45d5a3c
fix: phone auth uses navigator
demolaf Nov 5, 2025
dc4bc9d
refactor: remove redundant ui code from phone auth related views
demolaf Nov 5, 2025
4b3ab5b
Update samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExample.…
demolaf Nov 5, 2025
9bb28d0
remove language code argument and revert mfaEnabled in config
demolaf Nov 5, 2025
b6c32cb
Merge branch 'feat/ui-fixes' of github.com:demolaf/FirebaseUI-iOS int…
demolaf Nov 5, 2025
a1e2944
Merge pull request #1293 from demolaf/feat/ui-fixes
russellwheatley Nov 5, 2025
f06928b
fix: email link fix to decoding link
russellwheatley Nov 5, 2025
fe28cfe
chore: example app setup
russellwheatley Nov 5, 2025
f544498
chore: update associated domains to example app
russellwheatley Nov 5, 2025
356da89
chore: example app setup
russellwheatley Nov 5, 2025
482a0fc
Merge branch 'development' into clean-up-bugs
russellwheatley Nov 5, 2025
a48098a
chore: update wording
russellwheatley Nov 5, 2025
db585b1
chore: format code
russellwheatley Nov 5, 2025
080b27a
Merge pull request #1294 from firebase/clean-up-bugs
russellwheatley Nov 5, 2025
29840d4
Merge pull request #1295 from firebase/format
russellwheatley Nov 5, 2025
5ecf59c
refactor: allow providers to use whatever sign-in methods they wish
russellwheatley Nov 5, 2025
b3a336b
refactor: use typed provider to remove forced unwrapping
russellwheatley Nov 5, 2025
e7ec409
fix: use method overload for phone auth sign-in
russellwheatley Nov 6, 2025
572a693
refactor: remove duplicate code for phone sign-in
russellwheatley Nov 6, 2025
f43a9d8
fix: ensure user signs back in to continue with sensitive operation
russellwheatley Nov 6, 2025
a6948d1
format
russellwheatley Nov 6, 2025
4661345
chore: remove `authViewRoutes` as can access navigator directly
russellwheatley Nov 6, 2025
3a90dff
refactor: error modal pop-up handled in View layer
russellwheatley Nov 6, 2025
d8780f4
fix: put errorModal on NavigationStack
russellwheatley Nov 6, 2025
87fbc6a
chore: use emulator for example app
russellwheatley Nov 6, 2025
dbfc162
test: fix tests
russellwheatley Nov 6, 2025
bda7eea
refactor: moved account conflict logic into View layer
russellwheatley Nov 6, 2025
512668c
fix: make account handler optional, throw error if not available
russellwheatley Nov 6, 2025
859e364
Merge pull request #1296 from firebase/refactor-providers
russellwheatley Nov 6, 2025
bc040dd
Merge branch 'development' into api-refactor
russellwheatley Nov 6, 2025
8b2c906
chore: make reportError() optionally called
russellwheatley Nov 6, 2025
5614f14
chore: fix compiler errors and remove reportError from user code
russellwheatley Nov 6, 2025
7e1dcee
Merge pull request #1297 from firebase/api-refactor
russellwheatley Nov 6, 2025
feb1e28
Merge branch 'development' into merge-conflict-refactor
russellwheatley Nov 6, 2025
0ee4543
chore: remove comments
russellwheatley Nov 6, 2025
b9f893a
test: create test to lint code
russellwheatley Nov 7, 2025
57634d0
test: fix selector that was crashing tests
russellwheatley Nov 7, 2025
5f28ae9
fix: use single sheet for password coordination
russellwheatley Nov 7, 2025
205091d
test: use test helper for pasting into inputs
russellwheatley Nov 7, 2025
845b966
format
russellwheatley Nov 7, 2025
c25d82d
fix: lint errors
russellwheatley Nov 7, 2025
6299568
chore: remove dead code, handled in AccountConflictModifier
russellwheatley Nov 7, 2025
b634cba
Merge pull request #1299 from firebase/merge-conflict-refactor
russellwheatley Nov 7, 2025
8bd799b
Merge branch 'development' into improve-tests
russellwheatley Nov 7, 2025
78b9905
fix: more lint errors
russellwheatley Nov 7, 2025
15248bb
add validations for text inputs
demolaf Nov 7, 2025
0b7037f
fix: allow user to set their own callback for phone auth
russellwheatley Nov 7, 2025
92b58c7
refactor: use alert in email link and update password
demolaf Nov 7, 2025
e2797a3
fix: allow custom callback for email link sign-in
russellwheatley Nov 7, 2025
380a299
refactor: remove navigation push inside AuthService. move to View layer
russellwheatley Nov 7, 2025
0a8514e
Merge pull request #1302 from firebase/phone-custom-tap
russellwheatley Nov 7, 2025
432c0ea
move existing sample app to e2eTest folder and create new sample app
demolaf Nov 7, 2025
0a76ec8
Merge branch 'development' of https://github.com/firebase/FirebaseUI-…
demolaf Nov 7, 2025
742f176
Merge pull request #1301 from firebase/feat/cleanup-fixes
demolaf Nov 7, 2025
cff650f
Merge branch 'development' into improve-tests
russellwheatley Nov 7, 2025
b161bd2
format
russellwheatley Nov 7, 2025
591ea24
chore: use script so it can be ran locally
russellwheatley Nov 7, 2025
53c11d7
Increase timeout for UI tests to 60 minutes
russellwheatley Nov 7, 2025
9f15c72
sample app for FirebaseUI demo
demolaf Nov 7, 2025
f953e0c
fix: ci failing directory change to e2eTest
demolaf Nov 7, 2025
2a0d6a1
Merge pull request #1304 from firebase/feat/new-samples
russellwheatley Nov 7, 2025
4f27e15
Merge branch 'development' into improve-tests
russellwheatley Nov 7, 2025
7225dd7
fix: facebook method now only works in obj-c code
russellwheatley Nov 10, 2025
0891657
format
russellwheatley Nov 10, 2025
de5b950
fix: increase button width
russellwheatley Nov 10, 2025
35fae50
fix: ensure errors are reported from MFA Views
russellwheatley Nov 10, 2025
69c3a0c
test: fix tests to match latest UI
russellwheatley Nov 10, 2025
241d7cb
test: use proper teardown for enrolment tests
russellwheatley Nov 10, 2025
b256f55
test: run enrolment tests serially
russellwheatley Nov 10, 2025
cfe9663
test: remove parallel testing to stop hanging
russellwheatley Nov 10, 2025
16f95eb
test: just wait for signed-in View
russellwheatley Nov 10, 2025
4a52b73
Merge pull request #1305 from firebase/small-improvements
russellwheatley Nov 10, 2025
c77a7d7
Merge branch 'development' into improve-tests
russellwheatley Nov 10, 2025
f4d8abc
chore: add e2eTests to format and lint script
russellwheatley Nov 10, 2025
a0c9add
ci: decrease timeout to 40 mins for UI tests
russellwheatley Nov 10, 2025
354f734
Merge pull request #1300 from firebase/improve-tests
russellwheatley Nov 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 156 additions & 26 deletions .github/workflows/swiftui-auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ name: SwiftUI Auth

on:
push:
branches: [ main ]
branches: [ main, development ]
paths:
- '.github/workflows/swiftui-auth.yml'
- 'samples/swiftui/**'
- 'e2eTest/**'
- 'FirebaseSwiftUI/**'
- 'Package.swift'
pull_request:
branches: [ main ]
branches: [ main, development ]
paths:
- '.github/workflows/swiftui-auth.yml'
- 'samples/swiftui/**'
- 'e2eTest/**'
- 'FirebaseSwiftUI/**'
- 'Package.swift'

Expand All @@ -22,57 +24,185 @@ permissions:
contents: read

jobs:
swiftui-auth:
runs-on: macos-15
timeout-minutes: 30
format-check:
name: Swift Format Check
runs-on: macos-26
timeout-minutes: 10
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938

- name: Install swiftformat
run: brew install swiftformat

- name: Check Swift formatting
run: bash lint-swift.sh

# Package Unit Tests (standalone, no emulator needed)
unit-tests:
name: Package Unit Tests
runs-on: macos-26
timeout-minutes: 15
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938

- name: Install xcpretty
run: gem install xcpretty

- name: Select Xcode version
run: sudo xcode-select -switch /Applications/Xcode_26.0.1.app/Contents/Developer

- name: Run FirebaseSwiftUI Package Unit Tests
run: |
set -o pipefail
xcodebuild test \
-scheme FirebaseUI-Package \
-destination 'platform=iOS Simulator,name=iPhone 17' \
-enableCodeCoverage YES \
-resultBundlePath FirebaseSwiftUIPackageTests.xcresult | tee FirebaseSwiftUIPackageTests.log | xcpretty --test --color --simple

- name: Upload test logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: unit-tests-logs
path: FirebaseSwiftUIPackageTests.log

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: unit-tests-results
path: FirebaseSwiftUIPackageTests.xcresult

# Integration Tests (requires emulator)
integration-tests:
name: Integration Tests
runs-on: macos-26
timeout-minutes: 20
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938

- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
name: Install Node.js 20
with:
node-version: '20'

- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
distribution: 'temurin'
java-version: '17'

- name: Install Firebase
run: |
sudo npm i -g firebase-tools
run: sudo npm i -g firebase-tools

- name: Start Firebase Emulator
run: |
sudo chown -R 501:20 "/Users/runner/.npm" && cd ./samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExample && ./start-firebase-emulator.sh
sudo chown -R 501:20 "/Users/runner/.npm"
cd ./e2eTest/FirebaseSwiftUIExample/FirebaseSwiftUIExample
./start-firebase-emulator.sh

- name: Install xcpretty
run: gem install xcpretty

- name: Select Xcode version
run: sudo xcode-select -switch /Applications/Xcode_26.0.1.app/Contents/Developer

- name: Build for Integration Tests
run: |
sudo xcode-select -switch /Applications/Xcode_16.3.app/Contents/Developer
- name: Run Integration Tests
run: |
cd ./samples/swiftui/FirebaseSwiftUIExample
cd ./e2eTest/FirebaseSwiftUIExample
set -o pipefail
xcodebuild test -scheme FirebaseSwiftUIExampleTests -destination 'platform=iOS Simulator,name=iPhone 16 Pro' -enableCodeCoverage YES -resultBundlePath FirebaseSwiftUIExampleTests.xcresult | tee FirebaseSwiftUIExampleTests.log | xcpretty --test --color --simple
- name: Run View UI Tests
xcodebuild build-for-testing \
-scheme FirebaseSwiftUIExampleTests \
-destination 'platform=iOS Simulator,name=iPhone 17' \
-enableCodeCoverage YES | xcpretty --color --simple

- name: Run Integration Tests
run: |
cd ./samples/swiftui/FirebaseSwiftUIExample
cd ./e2eTest/FirebaseSwiftUIExample
set -o pipefail
xcodebuild test -scheme FirebaseSwiftUIExampleUITests -destination 'platform=iOS Simulator,name=iPhone 16 Pro' -enableCodeCoverage YES -resultBundlePath FirebaseSwiftUIExampleUITests.xcresult | tee FirebaseSwiftUIExampleUITests.log | xcpretty --test --color --simple
xcodebuild test-without-building \
-scheme FirebaseSwiftUIExampleTests \
-destination 'platform=iOS Simulator,name=iPhone 17' \
-enableCodeCoverage YES \
-resultBundlePath FirebaseSwiftUIExampleTests.xcresult | tee FirebaseSwiftUIExampleTests.log | xcpretty --test --color --simple

- name: Upload test logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: swiftui-auth-test-logs
path: |
samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExampleTests.log
samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExampleUITests.log
- name: Upload FirebaseSwiftUIExampleUITests.xcresult bundle
name: integration-tests-logs
path: e2eTest/FirebaseSwiftUIExample/FirebaseSwiftUIExampleTests.log

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: FirebaseSwiftUIExampleUITests.xcresult
path: samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExampleUITests.xcresult
- name: Upload FirebaseSwiftUIExampleTests.xcresult bundle
name: integration-tests-results
path: e2eTest/FirebaseSwiftUIExample/FirebaseSwiftUIExampleTests.xcresult

# UI Tests (requires emulator)
ui-tests:
name: UI Tests
runs-on: macos-26
timeout-minutes: 40
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938

- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
name: Install Node.js 20
with:
node-version: '20'

- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b
with:
distribution: 'temurin'
java-version: '17'

- name: Install Firebase
run: sudo npm i -g firebase-tools

- name: Start Firebase Emulator
run: |
sudo chown -R 501:20 "/Users/runner/.npm"
cd ./e2eTest/FirebaseSwiftUIExample/FirebaseSwiftUIExample
./start-firebase-emulator.sh

- name: Install xcpretty
run: gem install xcpretty

- name: Select Xcode version
run: sudo xcode-select -switch /Applications/Xcode_26.0.1.app/Contents/Developer

- name: Build for UI Tests
run: |
cd ./e2eTest/FirebaseSwiftUIExample
set -o pipefail
xcodebuild build-for-testing \
-scheme FirebaseSwiftUIExampleUITests \
-destination 'platform=iOS Simulator,name=iPhone 17' \
-enableCodeCoverage YES | xcpretty --color --simple

- name: Run UI Tests
run: |
cd ./e2eTest/FirebaseSwiftUIExample
set -o pipefail
xcodebuild test-without-building \
-scheme FirebaseSwiftUIExampleUITests \
-destination 'platform=iOS Simulator,name=iPhone 17' \
-parallel-testing-enabled NO \
-enableCodeCoverage YES \
-resultBundlePath FirebaseSwiftUIExampleUITests.xcresult | tee FirebaseSwiftUIExampleUITests.log | xcpretty --test --color --simple

- name: Upload Firebase Emulator logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: firebase-emulator-logs
path: e2eTest/FirebaseSwiftUIExample/FirebaseSwiftUIExample/firebase-debug.log

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: FirebaseSwiftUIExampleTests.xcresult
path: samples/swiftui/FirebaseSwiftUIExample/FirebaseSwiftUIExampleTests.xcresult
name: FirebaseSwiftUIExampleUITests.xcresult
path: e2eTest/FirebaseSwiftUIExample/FirebaseSwiftUIExampleUITests.xcresult
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import AuthenticationServices
import CryptoKit
import FirebaseAuth
import FirebaseAuthSwiftUI
import FirebaseCore
import SwiftUI

// MARK: - Data Extensions

extension Data {
var utf8String: String? {
return String(data: self, encoding: .utf8)
}
}

extension ASAuthorizationAppleIDCredential {
var authorizationCodeString: String? {
return authorizationCode?.utf8String
}

var idTokenString: String? {
return identityToken?.utf8String
}
}

// MARK: - Authenticate With Apple Dialog

private func authenticateWithApple(scopes: [ASAuthorization.Scope]) async throws -> (
ASAuthorizationAppleIDCredential,
String
) {
return try await AuthenticateWithAppleDialog(scopes: scopes).authenticate()
}

private class AuthenticateWithAppleDialog: NSObject {
private var continuation: CheckedContinuation<(ASAuthorizationAppleIDCredential, String), Error>?
private var currentNonce: String?
private let scopes: [ASAuthorization.Scope]

init(scopes: [ASAuthorization.Scope]) {
self.scopes = scopes
super.init()
}

func authenticate() async throws -> (ASAuthorizationAppleIDCredential, String) {
return try await withCheckedThrowingContinuation { continuation in
self.continuation = continuation

let appleIDProvider = ASAuthorizationAppleIDProvider()
let request = appleIDProvider.createRequest()
request.requestedScopes = scopes

do {
let nonce = try CryptoUtils.randomNonceString()
currentNonce = nonce
request.nonce = CryptoUtils.sha256(nonce)
} catch {
continuation.resume(throwing: AuthServiceError.signInFailed(underlying: error))
return
}

let authorizationController = ASAuthorizationController(authorizationRequests: [request])
authorizationController.delegate = self
authorizationController.performRequests()
}
}
}

extension AuthenticateWithAppleDialog: ASAuthorizationControllerDelegate {
func authorizationController(controller _: ASAuthorizationController,
didCompleteWithAuthorization authorization: ASAuthorization) {
if let appleIDCredential = authorization.credential as? ASAuthorizationAppleIDCredential {
if let nonce = currentNonce {
continuation?.resume(returning: (appleIDCredential, nonce))
} else {
continuation?.resume(
throwing: AuthServiceError.signInFailed(
underlying: NSError(
domain: "AppleSignIn",
code: -1,
userInfo: [NSLocalizedDescriptionKey: "Missing nonce"]
)
)
)
}
} else {
continuation?.resume(
throwing: AuthServiceError.invalidCredentials("Missing Apple ID credential")
)
}
continuation = nil
}

func authorizationController(controller _: ASAuthorizationController,
didCompleteWithError error: Error) {
continuation?.resume(throwing: AuthServiceError.signInFailed(underlying: error))
continuation = nil
}
}

// MARK: - Apple Provider Swift

public class AppleProviderSwift: CredentialAuthProviderSwift {
public let scopes: [ASAuthorization.Scope]
let providerId = "apple.com"

public init(scopes: [ASAuthorization.Scope] = [.fullName, .email]) {
self.scopes = scopes
}

@MainActor public func createAuthCredential() async throws -> AuthCredential {
let (appleIDCredential, nonce) = try await authenticateWithApple(scopes: scopes)

guard let idTokenString = appleIDCredential.idTokenString else {
throw AuthServiceError.invalidCredentials("Unable to fetch identity token from Apple")
}

let credential = OAuthProvider.appleCredential(
withIDToken: idTokenString,
rawNonce: nonce,
fullName: appleIDCredential.fullName
)

return credential
}
}

public class AppleProviderAuthUI: AuthProviderUI {
private let typedProvider: AppleProviderSwift
public var provider: AuthProviderSwift { typedProvider }
public let id: String = "apple.com"

public init(provider: AppleProviderSwift) {
typedProvider = provider
}

@MainActor public func authButton() -> AnyView {
AnyView(SignInWithAppleButton(provider: typedProvider))
}
}
Loading
Loading