Questions tagged [activitykit]

28 questions
4
votes
1 answer

Create state variable only in iOS 16.1?

Using global variable, this works: @available(iOS 16.1, *) var activity: Activity? If I want to try making it into a state variable, but I will get this error "'Activity' is only available in iOS 16.1 or newer". Is it possible…
Lim Thye Chean
  • 8,704
  • 9
  • 49
  • 88
3
votes
1 answer

iOS ActivityKit: Push Token Issues

iOS 16.1 brings ActivityKit that allows to show a Live Activity on Lock Screen (similar to Lock Screen widget but not quite the same). LiveActivity can receive a limited amount of data per an update (up to 4KB). We send updates to live activity…
Nimble
  • 1,009
  • 1
  • 11
  • 11
3
votes
1 answer

Dynamic Island SwiftUI Animations

How can I implement swiftUI animations on a dynamic island icon? I want to do this: DynamicIsland() { ... } compactLeading: { Image("my-icon").shineEffect() } compactTrailing: { Image("my-icon") } Where in shine effect I start the animation…
annaoomph
  • 552
  • 1
  • 4
  • 22
2
votes
2 answers

Updating LiveActivities with Push notifications

I am trying to update the live activities with push notifications and I use the two methods one to start the live activity and the other to update the live activity which are as follows: func startActivity(completion: @escaping (String) -> Void) { …
2
votes
0 answers

staleDate in ActivityKit (iOS 16.2 / 16.4) seems to have no effect

I have a Live Activity and need to update it frequently like every minute or every few minutes in a similar way that the Uber app updates its Live Activity to show you the progress of the ride. I am aware that push notifications are a general…
Raphael
  • 2,691
  • 1
  • 16
  • 21
2
votes
1 answer

Error "Trailing closure passed to parameter of type 'NSManagedObjectContext' that does not accept a closure" in Swift

I try to add a live activity to my app, in Swift. But when I try to run the app, the error message "Trailing closure passed to parameter of type 'NSManagedObjectContext' that does not accept a closure" appear. My app uses Core Data to save the data…
Julien01
  • 57
  • 5
2
votes
3 answers

Update Live Activity once per second - Swift

I'm searching for a way to update the Live Activity every second or every 2 seconds without using Push Notifications while keeping the app in background. Do you have any suggestions? I tried something like this, but after few seconds it's stop…
Pietro Messineo
  • 777
  • 8
  • 28
1
vote
0 answers

In some cases Live Activity "get frozen" and no updates

In the latest application update we’ve provided users with ability to receive live updates for Football matches using Live Activities. Our application supports up to 5 simultaneous activities (one per match) and all the updates can be provided…
Kostokord
  • 11
  • 1
1
vote
1 answer

Ending Live Activity in new iOS 16.2 ActivityKit API

I am following along the tutorial at https://www.youtube.com/watch?v=AUOoalBwxos However, the ActivityKit API used to start and end the live activity have been deprecated in iOS 16.2. I have figured out how to update the start method to the new API…
1
vote
1 answer

SwiftUI Text(_, style: .timer) bug in Live Activity

I added the Text(Date().addingTimeInterval(2400), style: .timer) in my Live Activity, but when its countdown to zero and the notification hasn't been delivered yet it starts to count up. Is it can be fixed? I tried to use the normal Timer but in the…
Empiric10
  • 25
  • 5
1
vote
2 answers

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

Animate content updates When you define the user interface of your Live Activity, the system ignores any animation modifiers — for example, withAnimation(_:_:) and animation(_:value:) — and uses the system’s animation timing instead. However, the…
Wen Su
  • 11
  • 1
1
vote
0 answers

How can I use a Core Data Image (Data) within a Live Activity?

I have an app that saves created user events with a title, date and an image for personal use. This is stored with Core Data so the Image is stored as Data. I have a shared App Group that I am trying to write the file to and then display it within…
Wood
  • 110
  • 7
1
vote
1 answer

SwiftUI LiveActivities on start throw weird errors

So, I trying to work with ActivityKit, to create a simple live activity. Code: TimerAttributes.swift import ActivityKit import SwiftUI struct TimerAttributes: ActivityAttributes { public typealias TimerStatus = ContentState public…
LNxD
  • 65
  • 8
1
vote
2 answers

How to fetch an image in the Live Activity (ActivityKit) - SwiftUI

Is it possible to load an image from remote in the Live Activity using ActivityKit? I tried various different methods, but none of them are working including: AsyncImage Pre-fetching the image in the App and passing that image to Activity as a Data…
user1258202
  • 170
  • 2
  • 9
0
votes
1 answer

how to start a liveActivity from a remote notification • Swift

When implementing lock screen live activity widget for debugging purposes I had a button which runs startLiveActivity() function, app runs normaly widget appears totally functioning. However I need this activity widget to appear whenever the app…
1
2