From 3ce7c51068cc45281f3a5fa353a8f4df6f7eca27 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 15 Apr 2026 16:29:03 -0500 Subject: [PATCH] Rename Environment -> TAKEnvironment to avoid SwiftUI collision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bare `Environment` message name clashes with SwiftUI's `@Environment` property wrapper, which is used by every SwiftUI view in an iOS consumer app. Importing the generated proto module (e.g. `MeshtasticProtobufs`) made `Environment` ambiguous in all 78 files of Meshtastic-Apple that reference `@Environment(\.scenePhase)` or similar, breaking the build. Field name `environment` on TAKPacketV2 stays unchanged — only the message type is renamed. Wire format is unaffected (proto3 encodes by tag number, not type name), but all generated code and source-level references must be regenerated. The `TAK` prefix matches the convention used by the outer TAKPacketV2 wrapper and is unambiguous across Swift (no SwiftUI/WeatherKit clash), Kotlin, Python, TypeScript, and C# targets. --- meshtastic/atak.proto | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/meshtastic/atak.proto b/meshtastic/atak.proto index b8a4fe5..7223ee1 100644 --- a/meshtastic/atak.proto +++ b/meshtastic/atak.proto @@ -1732,8 +1732,16 @@ message TaskRequest { * promotes it to a first-class structured field. * * Target wire cost: ~6-8 bytes compressed with a fully populated instance. + * + * Named `TAKEnvironment` (not just `Environment`) because the bare name + * collides with `SwiftUI.Environment` — every SwiftUI view in a consuming + * iOS app uses the `@Environment` property wrapper, and importing the + * generated proto module would make `Environment` ambiguous in every one + * of those files. The `TAK` prefix matches the convention used by the + * outer `TAKPacketV2` wrapper and is unambiguous across all target + * languages (Swift, Kotlin, Python, TypeScript, C#). */ -message Environment { +message TAKEnvironment { /* * Temperature in deci-degrees Celsius. 225 = 22.5°C. * Range covers -50°C to +50°C (-500 to +500) which spans every realistic @@ -1939,8 +1947,10 @@ message TAKPacketV2 { /* * Observed weather conditions (temperature, wind). From . + * Type is `TAKEnvironment`, not `Environment`, to avoid colliding with + * SwiftUI's `@Environment` property wrapper in iOS consumers. */ - optional Environment environment = 25; + optional TAKEnvironment environment = 25; /* * Sensor field-of-view cone (camera, FLIR, laser, etc.). From . */