Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions firebaseai/FirebaseAIExample/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ struct ContentView: View {
GroundingScreen(backendType: selectedBackend, sample: sample)
case "LiveScreen":
LiveScreen(backendType: selectedBackend, sample: sample)
case "AppleAIScreen":
if #available(iOS 27.0, *) {
AppleAIScreen()
} else {
Text("Apple Intelligence is only available on iOS 27 or newer.")
}
Comment on lines +116 to +120

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The availability check is set to iOS 27.0, which is a future version and will cause this feature to always fall back to the else block on current devices (iOS 18). Since Apple Intelligence and the FoundationModels framework are available starting in iOS 18.0/18.2, please update this check to the correct version (e.g., iOS 18.0 or iOS 18.2) so the screen can be accessed and tested.

Suggested change
if #available(iOS 27.0, *) {
AppleAIScreen()
} else {
Text("Apple Intelligence is only available on iOS 27 or newer.")
}
if #available(iOS 18.0, *) {
AppleAIScreen()
} else {
Text("Apple Intelligence is only available on iOS 18 or newer.")
}

default:
EmptyView()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
// Copyright 2026 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 Foundation
import FoundationModels

@available(iOS 26.0, *)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The struct is marked as available on iOS 26.0. Please update this to iOS 18.0 (or iOS 18.2) to match the actual availability of Apple Intelligence.

Suggested change
@available(iOS 26.0, *)
@available(iOS 18.0, *)

@Generable
public struct Itinerary: Equatable, Codable {
@Guide(description: "An exciting name for the trip.")
public let title: String

@Guide(description: "The name of the destination.")
public let destinationName: String

@Guide(description: "A brief, catchy description of the trip.")
public let description: String

@Guide(description: "An explanation of why this plan fits the user's request.")
public let rationale: String

@Guide(description: "A list of day plans.")
public let days: [DayPlan]

@Guide(description: "Any source attributions or links for the recommended places.")
public let attributions: [Attribution]?
}

@available(iOS 26.0, *)
@Generable
public struct Attribution: Equatable, Codable {
public let title: String
public let url: String
}

@available(iOS 26.0, *)
@Generable
public struct DayPlan: Equatable, Codable {
@Guide(description: "A unique title for this day.")
public let title: String

public let subtitle: String

@Guide(description: "A list of activities planned for this day.")
public let activities: [Activity]
}

@available(iOS 26.0, *)
@Generable
public struct Activity: Equatable, Codable {
public let type: ActivityKind
public let title: String
public let description: String
public let latitude: Double?
public let longitude: Double?
}

@available(iOS 26.0, *)
@Generable
public enum ActivityKind: String, Codable {
case sightseeing
case foodAndDining
case shopping
case hotelAndLodging

public var displayName: String {
switch self {
case .sightseeing: return "Sightseeing"
case .foodAndDining: return "Food & Dining"
case .shopping: return "Shopping"
case .hotelAndLodging: return "Hotel & Lodging"
}
}
}

@available(iOS 26.0, *)
@Generable
public struct IdentifiedObject: Equatable, Codable {
@Guide(description: "The name of the primary object or landmark detected.")
public let name: String

@Guide(description: "The category of the object (e.g. Landmark, Plant, Food, Animal, Device, Clothing).")
public let category: String

@Guide(description: "A short, 2-sentence description of the object and interesting facts.")
public let description: String
}

@available(iOS 26.0, *)
@Generable
public struct TextSummary: Equatable, Codable {
@Guide(description: "A list of exactly 2 key summary points.")
public let summaryPoints: [String]
}
Loading
Loading