From 4581852cf504662457063f20282793eef96bc27f Mon Sep 17 00:00:00 2001 From: Sylvain Bettinelli Date: Wed, 13 May 2026 04:46:08 +0000 Subject: [PATCH] fix(workoutkit): guard displayName par #available(iOS 18.0) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WorkoutStep.displayName est dispo uniquement à partir d'iOS 18. Notre fonction tolère iOS 17+ donc Swift refusait la compilation. Fix : guarde l'assignation par #available(iOS 18.0, *). Sur iOS 17, l'Apple Watch garde l'affichage natif Apple "Travail"/"Récupération". Sur iOS 18+, les labels custom Course/Marche/Vélo etc. s'appliquent. Co-Authored-By: Claude Opus 4.7 (1M context) --- ios/App/App/CoachWorkoutKit.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ios/App/App/CoachWorkoutKit.swift b/ios/App/App/CoachWorkoutKit.swift index e90f6af..7f1a1a5 100644 --- a/ios/App/App/CoachWorkoutKit.swift +++ b/ios/App/App/CoachWorkoutKit.swift @@ -163,8 +163,12 @@ public class CoachWorkoutKitPlugin: CAPPlugin, CAPBridgedPlugin { if let zone = spec.hrZone { ws.alert = HeartRateZoneAlert(zone: zone) } - if let label = spec.label, !label.isEmpty { - ws.displayName = label + // displayName n'est dispo qu'à partir d'iOS 18. Sur iOS 17, on + // garde l'affichage natif Apple "Travail" / "Récupération". + if #available(iOS 18.0, *) { + if let label = spec.label, !label.isEmpty { + ws.displayName = label + } } return IntervalStep(spec.isWork ? .work : .recovery, step: ws) }