At WWDC 2026, Apple opened the Foundation Models framework to third-party model adapters, which means you can access cloud-hosted models (like Gemini ) through the Foundation Models framework using the same API as you would use to access on-device models.
In your app, you can swap the model instance to route your requests to either on-device or cloud inference to fit your use case:
- On-device models offer maximum privacy, zero cost, and offline support.
- Cloud-hosted models offer large context windows, advanced capabilities, and more reasoning power.
You can access the cloud-hosted Gemini models through Apple's Foundation Models framework by using the Firebase SDK for Apple platforms – specifically the Firebase AI Logic library. This guide shows you how to get started.
To protect access to Gemini models, this guide also shows you how to set up Firebase App Check , which is critical even during development.
Prerequisites
-
Install the latest Xcode 27 beta .
-
An Apple platform simulator or a physical device, both running the corresponding beta OS version (for example, iOS 27 beta).
-
A new Xcode project of an Apple platforms app using a SwiftUI interface.
Supported Gemini models
The integration with Apple's Foundation Models framework supports the following Gemini models.
-
General purpose models
-
gemini-3.1-pro-preview -
gemini-3.5-flash -
gemini-3.1-flash-lite
-
-
Image-generating models
-
gemini-3-pro-image-preview(aka "Nano Banana Pro") -
gemini-3.1-flash-image-preview(aka "Nano Banana 2") -
gemini-2.5-flash-image(aka "Nano Banana")
-
Gemini Live API models and Imagen models are not supported. Note that Gemini 2.5 models are technically supported, but they're not recommended for new projects and require special configuration not covered in these guides.
Step 1: Create a Firebase project
We recommend starting with a new Firebase project to explore this integration.
-
Sign into the Firebase console .
-
Click Create a new Firebase project.
-
Follow the on-screen instructions. You do notneed to enable Google Analytics.
Step 2: Connect your app to Firebase
To connect your app to Firebase, you must register it with your Firebase project and add a configuration file to your codebase.
-
In the center of the project overview page, click the iOS+icon to launch the setup workflow.
-
Register your app:
-
Enter your app's bundle ID. Make sure it matches the bundle ID of the project you're building in Xcode.
-
Click Register app.
-
-
Add the Firebase configuration file. This file contains the settings for the Firebase SDK to connect to your Firebase project.
-
Click Download
to get your configuration file.GoogleService-Info.plist -
Move
into the root of your Xcode project and add it to all targets.GoogleService-Info.plist -
Click Nextin the Firebase console.
-
-
The workflow in the console provides generic instructions for adding the Firebase SDK to your app, so skip ahead to the next step in this guide for specific instructions for Firebase AI Logic .
Step 3: Add Firebase libraries and initialize Firebase in your app
-
Use Swift Package Manager to add the required Firebase libraries:
-
In Xcode, with your app project open, select File> Add Packages.
-
Enter the Firebase Apple SDK repository URL:
https://github.com/firebase/firebase-ios-sdk -
Select the Dependency Rule as Branchand enter
wwdc26-preview. -
Click Add Package. Xcode will resolve and download the dependencies.
-
When prompted, add the
FirebaseAILogicandFirebaseAppChecklibraries to your app target.
-
-
Initialize Firebase when your app starts up by adding the following code to your app's main entry point:
import SwiftUI import FirebaseCore @ main struct YourApp : App { init () { FirebaseApp . configure () } var body : some Scene { WindowGroup { NavigationView { ContentView () } } } }
Step 4: Enable and secure Firebase services
Now that your app is configured to use Firebase, you need to enable the Firebase AI Logic service and protect access to its associated APIs using Firebase App Check .
Step 4a: Set up Firebase AI Logic in your Firebase project
-
In the Firebase console, go to AI Services> AI Logic .
-
Click Get startedto launch the setup workflow.
-
We recommend choosing the Gemini Developer APIprovider to get started quickly at no cost.
Step 4b: Set up Firebase App Check in your Firebase project
When enforced, Firebase App Check only allows incoming requests that are from your actual app and an untampered device. Firebase App Check supports many attestation providers, including Apple's App Attest .
The following steps are for a baseline, default setup for App Check . Learn more about additional configuration options for App Check (like adjusting the TTL of tokens and enabling limited-use tokens).
Here's how to register the App Attest provider in the Firebase console:
-
In the Firebase console, go to Security> App Check .
-
Click Get started.
-
In the Appstab , register your app to use App Check with the App Attest provider .
-
In the APIstab , select Firebase AI Logic , and click Enforce.
Before distributing your app, configure the App Attest capability in Xcode
-
In Xcode, add the App Attest capability to your app.
-
In your Xcode project's
.entitlementsfile, set the App Attest environment toproduction.

