DeviceActivityReport
does not seem to re-render properly when a subview is popped off of a NavigationStack
. The following code (with the extension code generated directly from XCode boilerplate) renders the device activity report when the app loads, but after the button is pressed and the new subview is dismissed, the device activity view becomes blank.
I don't see the same behavior with a modal like .sheet()
.
XCode 14.2 (14C18), iOS 16.3 beta (20D5035i)
import SwiftUI
import DeviceActivity
extension DeviceActivityReport.Context {
static let totalActivity = Self("Total Activity")
}
struct OtherContentView: View {
var body: some View {
VStack {}
}
}
struct ContentView: View {
let context: DeviceActivityReport.Context = .totalActivity
let filter = DeviceActivityFilter(
segment:.daily(
during: DateInterval(
start: Date().addingTimeInterval(-24 * 3600),
end: Date()
)
)
)
var body: some View {
NavigationStack {
List {
NavigationLink(destination: {
OtherContentView()
}, label: {
Text("Press Me")
})
DeviceActivityReport(context, filter:filter)
.frame(maxWidth: .infinity, minHeight: 250.0)
}
}
}
}
If I put the report below the List
, like so...
var body: some View {
NavigationStack {
List {
NavigationLink(destination: {
OtherContentView()
}, label: {
Text("Press Me")
})
}
DeviceActivityReport(context, filter:filter)
.frame(maxWidth: .infinity, minHeight: 250.0)
}
...the report still shows after popping the subview from the navigation stack, but then after a few seconds it becomes blank with the following error reported in XCode terminal:
[default] VS terminated with error: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
Please file a bug report using Feedback Assistant. Thanks in advance!