Skip to content

[First Pass Feedback Requested] Create a new sample app that uses SPM#952

Open
w-goog wants to merge 18 commits intomasterfrom
swiftui-sample
Open

[First Pass Feedback Requested] Create a new sample app that uses SPM#952
w-goog wants to merge 18 commits intomasterfrom
swiftui-sample

Conversation

@w-goog
Copy link
Copy Markdown
Collaborator

@w-goog w-goog commented Apr 21, 2026

This PR creates a simple new sample app that uses SwiftUI & SPM. Being unable to do a straightforward build of the various sample apps from the command line motivated me to do so.

I'm guessing there's more to do here - in particular, I'd love to hear if a fresh clone works.

w-goog added 17 commits April 16, 2026 17:56
Scaffold for Examples/Example_Swift-SPM: Xcode project (bundle ID
net.openid.appauth.Example, no Example_Extension target), asset catalog,
and placeholder ExampleApp.swift/ContentView.swift generated by Xcode.
Orchestration will fill these in with AppAuth integration.
@w-goog w-goog requested review from brnnmrls and mdmathias April 21, 2026 03:16
Comment thread CHANGELOG.md
@@ -1,3 +1,6 @@
# Unreleased
- Add SwiftUI + Swift Package Manager sample app under `Examples/Example_Swift-SPM`.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we link the PR here? Some examples are in the bullets of the previous releases.

Comment thread Examples/README.md
* [Example for iOS (Objective-C)](Example-iOS_ObjC/README.md)
* [Example for iOS w/ Carthage (Objective-C)](Example-iOS_ObjC-Carthage/README.md)
* [Example for iOS w/ Carthage (Swift)](Example-iOS_Swift-Carthage/README.md)
* [Example for iOS w/ SPM (SwiftUI)](Example_Swift-SPM/README.md)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, can we rename here and the folder itself to [Example for iOS w/ SPM (SwiftUI)](Example-iOS_Swift-SPM/README.md) ?


### Configure the Example

This sample reads them from an xcconfig file. Create your local override file by copying the committed defaults:
Copy link
Copy Markdown
Collaborator

@brnnmrls brnnmrls Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may just be a me issue but I got confused when I read 'them' . Let's update to refer to the info above?


if let clientId = kClientID {
self.doAuthWithAutoCodeExchange(configuration: config, clientID: clientId, clientSecret: nil)
} else {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we ever enter this else block? Curious because in the init() we call validateOAuthConfiguration() which asserts there is a kClientID.


func validateOAuthConfiguration() {
assert(kClientID != nil, "Register your OIDC Client ID in Example.local.xcconfig (OIDC_CLIENT_ID).")
assert(kRedirectURI != "com.example.app:/oauth2redirect/example-provider", "Register your OIDC Redirect URI in Example.local.xcconfig (OIDC_REDIRECT_URI).")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this check? Asking since there seems to be a similar PreconditionFailure check on line 41.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants