fix: Resolve SwiftUI constraint update loop in MenuBarExtra

- Add .transaction { $0.animation = nil } to prevent constraint recalculation loops
- Add CreditsView.swift to Xcode project (was missing after git pull)
- Fixes NSGenericException for Update Constraints in Window passes
This commit is contained in:
Paweł Orzech 2026-01-18 21:25:49 +00:00
parent 71db6d4db1
commit 0764a38bb8
No known key found for this signature in database
4 changed files with 18 additions and 9 deletions

View file

@ -29,6 +29,7 @@
AAA00020 /* PropertiesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAA10021 /* PropertiesView.swift */; };
AAA00021 /* NetworkSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAA10022 /* NetworkSession.swift */; };
AAA00022 /* TravelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAA10023 /* TravelView.swift */; };
AAA00023 /* CreditsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAA10024 /* CreditsView.swift */; };
/* Unit Tests */
BBB00001 /* MockNetworkSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBB10001 /* MockNetworkSession.swift */; };
BBB00002 /* TestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBB10002 /* TestHelpers.swift */; };
@ -87,6 +88,7 @@
AAA10021 /* PropertiesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PropertiesView.swift; sourceTree = "<group>"; };
AAA10022 /* NetworkSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkSession.swift; sourceTree = "<group>"; };
AAA10023 /* TravelView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TravelView.swift; sourceTree = "<group>"; };
AAA10024 /* CreditsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreditsView.swift; sourceTree = "<group>"; };
AAA10000 /* MacTorn.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MacTorn.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* Unit Test Files */
BBB10001 /* MockNetworkSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockNetworkSession.swift; sourceTree = "<group>"; };
@ -190,6 +192,7 @@
AAA10006 /* SettingsView.swift */,
AAA10007 /* StatusView.swift */,
AAA10023 /* TravelView.swift */,
AAA10024 /* CreditsView.swift */,
AAA10017 /* MoneyView.swift */,
AAA10018 /* AttacksView.swift */,
AAA10019 /* FactionView.swift */,
@ -441,6 +444,7 @@
AAA00020 /* PropertiesView.swift in Sources */,
AAA00021 /* NetworkSession.swift in Sources */,
AAA00022 /* TravelView.swift in Sources */,
AAA00023 /* CreditsView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View file

@ -21,15 +21,18 @@ struct MenuBarLabel: View {
var body: some View {
// Show airplane + flag + countdown when traveling
if let travel = appState.data?.travel,
travel.isTraveling {
let destination = travel.destination ?? "?"
let flag = flagForDestination(destination)
let time = formatShortTime(appState.travelSecondsRemaining)
Text("✈️\(flag)\(time)")
} else {
Image(systemName: menuBarIcon)
Group {
if let travel = appState.data?.travel,
travel.isTraveling {
let destination = travel.destination ?? "?"
let flag = flagForDestination(destination)
let time = formatShortTime(appState.travelSecondsRemaining)
Text("✈️\(flag)\(time)")
} else {
Image(systemName: menuBarIcon)
}
}
.transaction { $0.animation = nil }
}
private var menuBarIcon: String {

View file

@ -136,7 +136,7 @@ struct StatusView: View {
Text(travel.isTraveling ? "Traveling to \(travel.destination ?? "Unknown")" : "In \(travel.destination ?? "Unknown")")
.font(.caption.bold())
}
if travel.isTraveling {
HStack {
Text("Arriving in:")
@ -152,6 +152,7 @@ struct StatusView: View {
.frame(maxWidth: .infinity, alignment: .leading)
.background(Color.blue.opacity(0.1))
.cornerRadius(8)
.transaction { $0.animation = nil }
}
// MARK: - Bars

View file

@ -74,6 +74,7 @@ struct FlyingStatusView: View {
.padding()
.background(Color.blue.opacity(0.1))
.cornerRadius(12)
.transaction { $0.animation = nil }
}
}