Post

Replies

Boosts

Views

Activity

Reply to Live Activity Timeline
@7_strikes The updates are not limited to Text timers, and those that are should not display seconds as the train arrivals aren't precise enough to warrant sub-minute accuracy. An "Arriving" train must be removed once it has departed (or has been scheduled to depart). Without that guarantee Live Activities are useless in this otherwise very useful situation.
2w
Reply to Live Activity Timeline
@DTS Engineer TimelineView does seem to be working. Maybe I had it configured wrong when I tried earlier or maybe I wasn't waiting long enough for an update - it seems like a cadence of about 30 seconds is the maximum refresh frequency allowed in a Live Activity. Thank you for pointing me in the right direction!
3w
Reply to Live Activity Timeline
[quote='909248022, 7_strikes, /thread/850307?answerId=909248022#909248022, /profile/7_strikes'] a push lost in a dead zone only costs staleness, and the next one corrects everything. A train that has just arrived sits at "arriving" until the next push [/quote] Unfortunately this is exactly the problem. The subway is full of dead zones and a user headed to a platform without service must not see stale trains in a perpetual "Arriving" state. As you pointed out, I will have the data locally to know when a train should have left, I just can't trigger a SwiftUI update to re-run without the app being alive in the background.
3w
Reply to Dynamic Type and Widget Layout
To answer my own question: Use ViewThatFits and build views with every possible count. Seems unnecessarily expensive but it works. var body: some View { ViewThatFits { ForEach((1...entry.toDos.count).reversed(), id: \.self) { limit in VStack(alignment: .leading, spacing: 4) { ForEach(entry.toDos.prefix(limit), id: \.self.identifier) { entry in ToDoView(checked: entry.completed, flag: entry.flag, text: entry.name) } if (limit < entry.toDos.count) { Text(String(format:NSLocalizedString("%i more...", comment: "[n] more..."), entry.toDos.count - limit)) .font(.footnote) .foregroundStyle(.secondary) .padding(.leading, 24) .padding(.top, -3) .unredacted() } } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’23
Reply to Live Activity Timeline
@7_strikes The updates are not limited to Text timers, and those that are should not display seconds as the train arrivals aren't precise enough to warrant sub-minute accuracy. An "Arriving" train must be removed once it has departed (or has been scheduled to depart). Without that guarantee Live Activities are useless in this otherwise very useful situation.
Replies
Boosts
Views
Activity
2w
Reply to Live Activity Timeline
@DTS Engineer Ugh, my mistake - it's not working. It was my app pushing updates to the Live Activity in the background while in the debugger. Once I detach the debugger and the main app suspends the updates stop. TimelineView is not working. I'll try to put together a quick demo project.
Replies
Boosts
Views
Activity
2w
Reply to Live Activity Timeline
@DTS Engineer TimelineView does seem to be working. Maybe I had it configured wrong when I tried earlier or maybe I wasn't waiting long enough for an update - it seems like a cadence of about 30 seconds is the maximum refresh frequency allowed in a Live Activity. Thank you for pointing me in the right direction!
Replies
Boosts
Views
Activity
3w
Reply to Live Activity Timeline
[quote='909248022, 7_strikes, /thread/850307?answerId=909248022#909248022, /profile/7_strikes'] a push lost in a dead zone only costs staleness, and the next one corrects everything. A train that has just arrived sits at "arriving" until the next push [/quote] Unfortunately this is exactly the problem. The subway is full of dead zones and a user headed to a platform without service must not see stale trains in a perpetual "Arriving" state. As you pointed out, I will have the data locally to know when a train should have left, I just can't trigger a SwiftUI update to re-run without the app being alive in the background.
Replies
Boosts
Views
Activity
3w
Reply to Dynamic Type and Widget Layout
To answer my own question: Use ViewThatFits and build views with every possible count. Seems unnecessarily expensive but it works. var body: some View { ViewThatFits { ForEach((1...entry.toDos.count).reversed(), id: \.self) { limit in VStack(alignment: .leading, spacing: 4) { ForEach(entry.toDos.prefix(limit), id: \.self.identifier) { entry in ToDoView(checked: entry.completed, flag: entry.flag, text: entry.name) } if (limit < entry.toDos.count) { Text(String(format:NSLocalizedString("%i more...", comment: "[n] more..."), entry.toDos.count - limit)) .font(.footnote) .foregroundStyle(.secondary) .padding(.leading, 24) .padding(.top, -3) .unredacted() } } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’23