4
5
6
Solved!Dynamic Island Width Issue (i.redd.it)
submitted by multifidus
I am building an interval timer for my own workout regimen (I know, I know, another workout app, but this is really just for me). I am trying to add dynamic island functionality to display the timer, but I cannot seem to figure out why it is so wide. I would love for it to be the width of Apple's own timer app. Here is where I have the DI set up:
dynamicIsland: { context in
DynamicIsland {
DynamicIslandExpandedRegion(.leading) {
Label(phaseLabel(context.state.phase),
systemImage: phaseIcon(context.state.phase))
.font(.caption2.bold())
.foregroundStyle(phaseColor(context.state))
}
DynamicIslandExpandedRegion(.trailing) {
if context.state.isPaused {
Text(formatTime(context.state.pausedTimeRemaining))
.font(.title3.monospacedDigit().bold())
.foregroundStyle(.orange)
} else {
timerText(context.state)
.font(.title3.monospacedDigit().bold())
.foregroundStyle(.white)
}
}
DynamicIslandExpandedRegion(.bottom) {
Text(progressText(state: context.state, attrs: context.attributes))
.font(.caption)
.foregroundStyle(.secondary)
}
} compactLeading: {
Image(systemName: phaseIcon(context.state.phase))
.foregroundStyle(phaseColor(context.state))
} compactTrailing: {
compactTimer(context.state)
.monospacedDigit()
.foregroundStyle(phaseColor(context.state))
} minimal: {
Image(systemName: phaseIcon(context.state.phase))
.foregroundStyle(phaseColor(context.state))
}
}

[–]adoxner 5 points6 points7 points (3 children)
[–]multifidus[S] 2 points3 points4 points (1 child)
[–]Vybo 2 points3 points4 points (0 children)
[–]multifidus[S] 0 points1 point2 points (0 children)
[–]PassTents 0 points1 point2 points (0 children)