Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
72acfe4
Add live audio screen
daymxn Oct 7, 2025
caaa8cd
Add microphone usage description
daymxn Oct 7, 2025
ca5df45
Add live screen to xcode project
daymxn Oct 7, 2025
39d50cb
Fix bug in transcript view model
daymxn Oct 7, 2025
693e498
Formatting
daymxn Oct 7, 2025
9b818ff
Fix typo
daymxn Oct 7, 2025
8d53bad
Add docs for extension property
daymxn Oct 7, 2025
74a7349
Remove app check import
daymxn Oct 8, 2025
4bdeea4
Make int16Data not nullable
daymxn Oct 8, 2025
7a2e3ea
Make audio controller an actor
daymxn Oct 8, 2025
e51984f
Rename ModelPhoto to ModelAvatar
daymxn Oct 29, 2025
d6a2986
Adjust TranscriptView text style
daymxn Oct 29, 2025
a61a459
Move Color extension to new file
daymxn Oct 29, 2025
e654c84
Add error handling instead of fatalError
daymxn Oct 29, 2025
b20448c
Update minimum version
daymxn Oct 29, 2025
d4d1edd
Add function calling tip
daymxn Oct 29, 2025
2fc8b45
Fix error view
daymxn Oct 29, 2025
52a24f5
Disable playback on simulator
daymxn Oct 29, 2025
b8238e4
Adjust connect button to be compat with glass
daymxn Oct 30, 2025
e19a16d
Increase line char length
daymxn Oct 30, 2025
a32fbda
Simplify the transcript view
daymxn Oct 30, 2025
52e4f54
Update project.pbxproj
daymxn Oct 30, 2025
e3dde93
Merge branch 'main' into dlr/add-live-audio
daymxn Oct 30, 2025
4e03f14
Merge branch 'main' into dlr/add-live-audio
daymxn Dec 8, 2025
81bf0d1
Migrate to the new structure
daymxn Dec 8, 2025
6fd9af9
Remove the old code
daymxn Dec 8, 2025
cbb1182
Update FirebaseAIExampleApp.swift
daymxn Dec 8, 2025
82b032e
formatting
daymxn Dec 8, 2025
d830f65
Add audio playback toggle when running on the simulator (#1826)
andrewheard Dec 9, 2025
4a491ce
Fix concurrency warnings
daymxn Dec 10, 2025
0ddc62d
Use logger instead of print
daymxn Dec 10, 2025
54ea164
Fix deinit logic not triggering
daymxn Dec 10, 2025
be1f51b
Use default font and size
daymxn Dec 10, 2025
ef9510b
Add border to connected
daymxn Dec 10, 2025
e3a58b7
Use non fill variants of icons
daymxn Dec 10, 2025
c75c740
Use system colors
daymxn Dec 10, 2025
0d6e84e
Split view modifiers across two lines
daymxn Dec 10, 2025
0427e11
Use style instead of inline configuration
daymxn Dec 10, 2025
4b2e01c
formatting
daymxn Dec 10, 2025
0d07e72
Fix typo
daymxn Dec 11, 2025
9856ef5
Add full width back to connect button
daymxn Dec 11, 2025
6fe2bca
Put view modifiers on their own lines
daymxn Dec 11, 2025
159de5c
Fix explicit color usage
daymxn Dec 11, 2025
f7e07c8
Use TipKit instead of custom TipView
daymxn Dec 11, 2025
99a4a7a
Add preview for InlineTip
daymxn Dec 11, 2025
e3a4bf9
Make audio playback toggle present during session
daymxn Dec 11, 2025
f655d18
formatting
daymxn Dec 11, 2025
255181f
Fix compile error
daymxn Dec 11, 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
2 changes: 2 additions & 0 deletions firebaseai/FirebaseAIExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSMicrophoneUsageDescription = "The app needs access to your microphone to enable live voice conversations with Gemini.";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
Expand Down Expand Up @@ -304,6 +305,7 @@
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSMicrophoneUsageDescription = "The app needs access to your microphone to enable live voice conversations with Gemini.";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "gemini-logo.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions firebaseai/FirebaseAIExample/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ struct ContentView: View {
FunctionCallingScreen(backendType: selectedBackend, sample: sample)
case "GroundingScreen":
GroundingScreen(backendType: selectedBackend, sample: sample)
case "LiveScreen":
LiveScreen(backendType: selectedBackend, sample: sample)
default:
EmptyView()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// 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.

#if canImport(FirebaseAILogic)
import FirebaseAILogic
#else
import FirebaseAI
#endif
import SwiftUI
import TipKit

struct LiveScreen: View {
let backendType: BackendOption
@StateObject var viewModel: LiveViewModel

init(backendType: BackendOption, sample: Sample? = nil) {
self.backendType = backendType
_viewModel =
StateObject(wrappedValue: LiveViewModel(backendType: backendType,
sample: sample))
}

var body: some View {
VStack(spacing: 20) {
ModelAvatar(isConnected: viewModel.state == .connected)
TranscriptView(typewriter: viewModel.transcriptTypewriter)

Spacer()
if let error = viewModel.error {
ErrorDetailsView(error: error)
}
if let tip = viewModel.tip, !viewModel.hasTranscripts {
TipView(tip)
}
ConnectButton(
state: viewModel.state,
onConnect: viewModel.connect,
onDisconnect: viewModel.disconnect
)

#if targetEnvironment(simulator)
AudioOutputToggle(isEnabled: $viewModel.isAudioOutputEnabled, onChange: {
Task {
await viewModel.onAudioPlaybackChanged()
}
})
#endif
}
.padding()
.navigationTitle(viewModel.title)
.navigationBarTitleDisplayMode(.inline)
.background(viewModel.backgroundColor ?? .clear)
.onDisappear {
Task {
await viewModel.disconnect()
}
}
}
}

#Preview {
LiveScreen(backendType: .googleAI)
}
Loading