Hello, thanks for your response. Since I first posted, I discovered I can get the scene to render within the iPhone simulator on my mac, but not on my physical iPhone. However, the scene renders fine on my phone when it is in the main app and not within the DeviceActivityReportExtension, so I don't think it's a hardware issue with my phone. Here is my DeviceActivityReportExtension containing my DeviceActivityReportScene.
import DeviceActivity
import SwiftUI
@main
struct TestActivityReport: DeviceActivityReportExtension {
var body: some DeviceActivityReportScene {
TotalActivityReport { totalActivity in
TotalActivityView(totalActivity: totalActivity)
}
}
}
Here is how I am calling the extension from the main app
struct ContentView: View
let context = DeviceActivityReport.Context.totalActivity
let now = Date()
let oneWeekAgo = Calendar.current.date(byAdding: .day, value: -7, to: Date())!
var body: some View {
DeviceActivityReport(context, filter: DeviceActivityFilter(segment: .daily(during: DateInterval(start: oneWeekAgo, end: now))))
}
}
The TotalActivityView just renders the TestScene from my initial post.
Thanks!
Topic:
App & System Services
SubTopic:
General
Tags: