I finally found a solution by exploring this example app: https://iosexample.com/a-demo-app-exploring-the-new-app-intents-framework-in-ios16/.
Here is my new (working) implementation of ActivityEntity:
struct ActivityEntity: AppEntity {
static var typeDisplayRepresentation = TypeDisplayRepresentation(name: "Activity")
typealias DefaultQuery = MobilityActivityQuery
static var defaultQuery: MobilityActivityQuery = MobilityActivityQuery()
var id: String
var name: String
var displayRepresentation: DisplayRepresentation {
DisplayRepresentation(title: "\(self.name)")
}
}
Post
Replies
Boosts
Views
Activity
I found following message in the console: Connection 1: received failure notification. Is there a way to detect this? No delegate method is called, neither in URLSessionTaskDelegate nor in URLSessionDelegate
Since I am using SwiftUI there is no viewDidLoad() function. Furthermore it should always be updated after a peripheral connected or disconnected.
I tried to update the TimerWrapper class and pass it through all my views, but that did not work. Anyway the implementation directly into the view needing the timer worked just fine, so thanks for your answer.I am also already in thouch with the author of the article and he wants to update it.