Files
TREK/client/ios/App/TREKWatch/FacesView.swift
T
Maurice e59af6dcb3 feat(native): TREK on Apple Watch, with complications
A watchOS app embedded in the iPhone app: today's next stop with its
countdown, the next booking with reference, seat and platform, the trip
with its days and places (Directions into Apple Maps), and the packing
list and to-dos to tick off. The phone sends the snapshot through
WatchConnectivity; ticks go back as queued user info. Three
complications (next stop, countdown, trip day) in every accessory family,
scored for the Smart Stack. 28 languages.

The native workflow captures every screen from watchOS simulators in a
screenshot mode, on the largest and the smallest watch.
2026-11-07 17:14:09 +01:00

43 lines
2.0 KiB
Swift

import SwiftUI
/// Screenshot mode only (-TrekDemo faces): every complication in every
/// family, on a dark dial, to review them without setting up a watch face.
struct FacesView: View {
let snapshot: WatchSnapshot?
let now: Date
var body: some View {
let state = ComplicationState(snapshot, now: now)
ScrollView {
VStack(alignment: .leading, spacing: 10) {
HStack(spacing: 8) {
dial(.circular) { NextStopComplication(state: state, family: .circular, now: now) }
dial(.circular) { CountdownComplication(state: state, family: .circular, now: now) }
dial(.circular) { TripDayComplication(state: state, family: .circular) }
}
dial(.rectangular) { NextStopComplication(state: state, family: .rectangular, now: now) }
dial(.rectangular) { CountdownComplication(state: state, family: .rectangular, now: now) }
dial(.rectangular) { TripDayComplication(state: state, family: .rectangular) }
dial(.inline) { NextStopComplication(state: state, family: .inline, now: now) }
dial(.inline) { CountdownComplication(state: state, family: .inline, now: now) }
dial(.inline) { TripDayComplication(state: state, family: .inline) }
}
.foregroundStyle(.white)
.tint(Color(hex: 0xFF9F0A))
}
}
private func dial<Content: View>(_ family: ComplicationFamily, @ViewBuilder _ content: () -> Content) -> some View {
let size: CGSize = switch family {
case .circular: CGSize(width: 50, height: 50)
case .rectangular: CGSize(width: 170, height: 64)
case .corner: CGSize(width: 40, height: 40)
case .inline: CGSize(width: 170, height: 18)
}
return content()
.frame(width: size.width, height: size.height)
.clipped()
.overlay(RoundedRectangle(cornerRadius: family == .circular ? 25 : 6).stroke(Color.white.opacity(0.08)))
}
}