I’m presently studying iOS Widgets, and I’ve encountered this unusual error when I attempt to preview my widget. Here’s what the Diagnostics says:
== PREVIEW UPDATE ERROR:
PotentialCrashError: Replace failed
ZohoMailWidgetTest might have crashed. Verify ~/Library/Logs/DiagnosticReports for any crash logs out of your software.
==================================
| RemoteHumanReadableError
|
| ArchivingError: failedToEncode(varieties: [SwiftUI.(unknown context at $107d0ac9c).ListRepresentable<SwiftUI.CollectionViewListDataSource<Swift.Never>, SwiftUI.SelectionManagerBox<Swift.Never>>, SwiftUI.(unknown context at $107d0ac9c).ListRepresentable<SwiftUI.CollectionViewListDataSource<Swift.Never>, SwiftUI.SelectionManagerBox<Swift.Never>>])
The related physique of my code appears like this:
struct MailWidgetTestWidgetEntryView : View {
var entry: Supplier.Entry
var physique: some View {
HStack {
VStack {
VStack {
Picture(systemName: "envelope")
Textual content("494")
}
Picture(systemName: "pencil.circle.fill")
.body(maxHeight: .infinity, alignment: .backside)
}
Listing {
MailWidgetListCellView()
MailWidgetListCellView()
MailWidgetListCellView()
}
}
}
}
struct MailWidgetListCellView: View {
var physique: some View {
HStack {
VStack {
HStack {
Textual content("Group Spark")
.font(.subheadline)
.body(maxWidth: .infinity, alignment: .main)
Textual content("12:15 PM")
.font(.caption)
}
Textual content("Use Spark to reclaim your focus")
.font(.subheadline)
.body(maxWidth: .infinity, alignment: .main)
}
Picture(systemName: "checkmark.circle.fill")
.font(.title)
.body(maxHeight: .infinity)
}
}
}
This error doesn’t pop up once I change my Listing
right into a VStack
as a substitute, like this:
struct MailWidgetTestWidgetEntryView : View {
var entry: Supplier.Entry
var physique: some View {
HStack {
VStack {
VStack {
Picture(systemName: "envelope")
Textual content("494")
}
Picture(systemName: "pencil.circle.fill")
.body(maxHeight: .infinity, alignment: .backside)
}
VStack { //no errors now
MailWidgetListCellView()
MailWidgetListCellView()
MailWidgetListCellView()
}
}
}
}
I’m unable to seek out any answer to this drawback wherever else. Does anybody know the way I can repair this?