Live Activity animate

When Live Activity updates data, the picture will fade in and fade out, how to turn off this animation effect

Based on apple's developer documentation for ActivityKit, You cannot change the default animation for Live Activities. The system ignores any animation modifiers that you specify and uses its own animation timing instead. However, you can configure the built-in transitions for adding and removing views, and for timer text.

To achieve no effect, you can use multiple views that pop in and out based on the content state.

if !context.state.imageName.isEmpty {
  Image(systemName: context.state.imageName)
    .resizable()
    .frame(width: 30, height: 30)
    .padding(.trailing, 10)
} else {
  Image("live-activity-logo")
    .resizable()
    .frame(width: 30, height: 30)
    .padding(.trailing, 10)
}

You can use the transition modifier for these views to appear in an animated way as described in the documentation.

Live Activity animate
 
 
Q