Lower deployment target from iOS 26 to iOS 18, gate Foundation Models behind @available

Broadens installable audience to iOS 18+ while keeping AI insights available on iOS 26.
Foundation Models types and service wrapped in @available(iOS 26, *), InsightsViewModel
conditionally instantiates the service with fallback UI on older versions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-02-23 20:21:45 -06:00
parent 7660521540
commit b2b6931d7c
5 changed files with 53 additions and 26 deletions

View File

@@ -9,6 +9,7 @@ import Foundation
import FoundationModels
/// Represents a single AI-generated insight using @Generable for structured LLM output
@available(iOS 26, *)
@Generable
struct AIInsight: Equatable {
@Guide(description: "A brief, engaging title for the insight (3-6 words)")
@@ -31,6 +32,7 @@ struct AIInsight: Equatable {
}
/// Container for period-specific insights - the LLM generates this structure
@available(iOS 26, *)
@Generable
struct AIInsightsResponse: Equatable {
@Guide(description: "Array of exactly 5 diverse insights covering patterns, advice, and predictions")
@@ -39,6 +41,7 @@ struct AIInsightsResponse: Equatable {
// MARK: - Conversion to App's Insight Model
@available(iOS 26, *)
extension AIInsight {
/// Converts AI-generated insight to the app's existing Insight model
func toInsight() -> Insight {
@@ -60,6 +63,7 @@ extension AIInsight {
}
}
@available(iOS 26, *)
extension AIInsightsResponse {
/// Converts all AI insights to app's Insight models
func toInsights() -> [Insight] {

View File

@@ -127,7 +127,7 @@ enum DayViewStyle: Int, CaseIterable {
case wave = 13 // Horizontal gradient river bands
case pattern = 14 // Mood icons as repeating background pattern
case leather = 15 // Skeuomorphic leather with stitching
case glass = 16 // iOS 26 liquid glass with variable blur
case glass = 16 // Liquid glass with variable blur
case motion = 17 // Accelerometer-driven parallax effect
case micro = 18 // Ultra compact single-line entries
case orbit = 19 // Celestial circular orbital arrangement