Use our iOS and macOS sample app to see how Sign-In works, or add Sign-In to your existing app.
This sample shows how to integrate Sign-In in Swift for iOS and macOS.
For Objective-C, see the SignInSample sample app in the Google Sign-In for iOS repository.
To use this sample, make sure you have a current version of Xcode installed.
Get the project
The DaysUntilBirthday Swift sample app is available in the Sign-In repository using CocoaPods and Swift Package Manager. Follow the instructions for your preferred option below to download and run the sample app:
CocoaPods
- If you don't already have CocoaPods installed, follow the steps in the CocoaPods Getting Started guide.
-
Clone the Google Sign-In for iOS repository:
git clone https://github.com/google/GoogleSignIn-iOS
-
Navigate to the
DaysUntilBirthday
directory:cd GoogleSignIn-iOS/Samples/Swift/DaysUntilBirthday
-
Install the Cocoapods dependencies:
pod install
-
Open the
DaysUntilBirthdayForPod
workspace in Xcode:open DaysUntilBirthdayForPod.xcworkspace
Swift Package Manager
-
Clone the Sign-In for iOS repository:
git clone https://github.com/google/GoogleSignIn-iOS
-
Open the Swift sample project:
open GoogleSignIn-iOS/Samples/Swift/DaysUntilBirthday/DaysUntilBirthday.xcodeproj
Swift Package Manager will automatically add the dependencies when Xcode opens the project.
Run the application
For iOS, select the DaysUntilBirthday (iOS)
target, then start the
sample application on a device or in the iOS simulator by clicking the run
button for the workspace.
For macOS, select the DaysUntilBirthday (macOS)
target, then start
the sample application by clicking the run button for the workspace.
Next steps
If you want to see how you can implement Google Sign-In in your own app, take a look at our implementation guide. Or, take a look at the complete sample on GitHub.
Did you have a good experience? Run into trouble? Let us know!