Files
swiftcontrol/ios/TrainerActivity/TrainerActivityAttributes.swift
Jonas Bark 447af0ebf4 ios: add TrainerActivity Widget Extension (Lock Screen + Dynamic Island)
Adds all source files for the TrainerActivity WidgetKit extension:
TrainerActivity.swift (@main, Lock Screen banner + Dynamic Island views),
TrainerActivityAttributes.swift (ActivityAttributes struct with gear,
mode, power, cadence, and erg-target fields), Info.plist, and
TrainerActivity.entitlements (App Group group.de.jonasbark.swiftcontrol.overlay).

A README documents the one-time manual Xcode steps required to wire the
target before flutter build ios will succeed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 09:20:45 +02:00

40 lines
1.3 KiB
Swift

import ActivityKit
import Foundation
public struct TrainerActivityAttributes: ActivityAttributes {
public struct ContentState: Codable, Hashable {
public var gear: Int
public var maxGear: Int
public var mode: String // "sim" | "erg"
public var powerW: Int?
public var cadenceRpm: Int?
public var ergTargetW: Int?
public var showPower: Bool
public var showCadence: Bool
public var showErgTarget: Bool
public var showGearRatio: Bool
public var gearRatio: Double
public init(
gear: Int, maxGear: Int, mode: String,
powerW: Int?, cadenceRpm: Int?, ergTargetW: Int?,
showPower: Bool, showCadence: Bool, showErgTarget: Bool, showGearRatio: Bool,
gearRatio: Double
) {
self.gear = gear
self.maxGear = maxGear
self.mode = mode
self.powerW = powerW
self.cadenceRpm = cadenceRpm
self.ergTargetW = ergTargetW
self.showPower = showPower
self.showCadence = showCadence
self.showErgTarget = showErgTarget
self.showGearRatio = showGearRatio
self.gearRatio = gearRatio
}
}
public init() {}
}