Today, I made the first attempt at running an existing SwiftUI iOS app in Xcode 14.0 beta 2. In preview, simulator and device, attempting to display several of the views caused the a crash with this (simulator) warning:
SwiftUI/UIViewControllerRepresentable.swift:332: Fatal error: UIViewControllerRepresentables must be value types: ViewControllerResolver
2022-06-30 15:42:51.037629-0400 Shorty[8477:188610] SwiftUI/UIViewControllerRepresentable.swift:332: Fatal error: UIViewControllerRepresentables must be value types: ViewControllerResolver
The app runs in iOS 15 without this issue.
I have no idea where to start looking to fix this. How can I begin to troubleshoot this? I see no content from a search here or outside.
Post
Replies
Boosts
Views
Activity
Working in latest version of Xcode 12.
When opening a SwiftUI view containing a Core Data list, a crash occurs and execution stops at the first line of the AppDelegate. There is no backtrace info in the console and from what I can see in the backtrace (attached crash.txt), and by stepping through each frame in Xcode, I don't see any code in my app.
Is this a bug? Advice on how to fix? In Xcode 13.0 (only), I cannot view any List. The same code runs as expected in Xcode 12.5
David
crash.txt
After watching WWDC 2016 session 420, Optimizing Web Content in Your App, I added "com.apple.webinspector.allow = YES" to the existing entitlements file.Build & Run results in immediate crash. Reviewing the crash log reveals Exception Type: EXC_CRASH (Code Signature Invalid)Remove that row from the entitlement file and the app runs fine.How can this be fixed, so that the app may connect to the Safari developer tools?
In the attached code, both with sections (commented lines) and without, when a row is deleted, 3 different animations occur, depending on the location of the deleted row.
Sometimes, the animation is smooth and as expected - the line just fades out. For other rows, a remaining row "jumps in" from the left side of the screen and at lastly, a remaining row "flies down" from above. The result is an unclean animation.
Has anyone seen this behavior or do I have a error in the implementation? Any suggestions?
David
import SwiftUI
struct DeleteTest: View {
		@State private var users = [["Paul", "Taylor", "Adele", "Michael", "Courtney"],
["James", "Peter", "Paul", "Mary"],
["Hugo", "Natalie", "Heber", "Nata"]]
@State private var allUsers = ["Paul", "Taylor", "Adele", "Michael", "Courtney", "James", "Peter", "Paul", "Mary", "Hugo", "Natalie", "Heber", "Nata"]
var body: some View {
NavigationView {
List {
// plain list
								ForEach(allUsers.indices, id: \.self) { i in
NavigationLink(allUsers[i], destination: EmptyView())
}
.onDelete { rowSet in
allUsers.remove(at: rowSet.last!)
}
								// grouped list
// ForEach(users.indices, id: \.self) { i in
// Section {
// ForEach(users[i].indices, id: \.self) { j in
// NavigationLink(users[i][j], destination: EmptyView())
// // Text(user)
// }
// .onDelete { rowSet in
// self.delete(section: i, at: rowSet)
// }
// }
// }
}
.listStyle(GroupedListStyle())
.navigationBarTitle("Names", displayMode: .inline)
}
}
func delete(section: Int, at offsets: IndexSet) {
		 users[section].remove(at: offsets.last!)
}
}
At 7:06 in the video - https://developer.apple.com/videos/play/wwdc2020/10041/?time=706, Taylor begins talking about the new .toolbar modifier.
Since .navigationBarItems has been deprecated, I am trying to make the same with it's replacement - .toolbar. I have tried many ways to have an image and text exist in a NavigationView toolbar, none of which are working.
.toolbar(content: {
ToolbarItem(placement: .navigationBarLeading) {
Button(action: {
self.sheetIsPresented.toggle()
}) {
HStack {
Image(systemName: sortType == .all ? "line.horizontal.3.decrease.circle" : "line.horizontal.3.decrease.circle.fill"))
Text(sortType.rawValue)
}
}
				.sheet(isPresented: $sheetIsPresented) { ... }
		 }
}
With this code, only the text will show. It seems like a bug, but I wonder if I'm missing something.
Feedback item: FB8275764
David