Post

Replies

Boosts

Views

Activity

Reply to Xcode 15.0 Release doesn't connect at all iOS 17
Hi, I had a similar issue with my iPhone and Xcode, even when the phone was connected to the Mac via USB cable still had issues. For me what worked was to close the VPN client. Once the VPN client is closed, I could debug over USB without problem. Another colleague had even worst issues where the Xcode did not recognise his phone even has been trusted. After trying to unpair the phone he couldn't pair it again anymore. Killing usbmuxd seems to do nothing for that problem. For him, remove all Xcode cached directories and rebooting the system seemed to get it somehow. But then started experiencing extreme slowness while debugging. Even on my personal computer where I don't use VPN had some glitches and issues while trying to get all to work. As always Apple did a terrible testing job when releasing new OS and tools, I can't understand how they keep repeating the same mistakes year after year. So as a short summary: Ensure you don't have a VPN connection active while debugging neither on the iOS or Mac If still having issues with it, clean DerivatedData and reboot the Mac. Those steps seemed to work fine for me and my colleague. I hope this helps you too.
Sep ’23
Reply to SwiftUI presentationMode dismiss not work on specific case
I will add a case where I experienced the same problem and how I did solve it. I noticed also this problem when modifying my DataModel which is a @EnvironmentObject When the button Save was pressed I was updating the dataModel and then dismissing the view with the presentationMode object. That was causing the dismissal to not work at all. Dismiss was working fine in the example below if the author was not valid so the model was not updated. I narrowed the problem down to the dataModel.authors marked as @Published. If I do remove the annotation it will work. So It seems like a SwiftUI bug to me. Cos I need the authors to be @Published so the changes are updated in the other views, a way to fix it is for this particular case is to have a @State var shouldSave: Bool and use the method onDisappear() to then set the values to the model. Also using a delay with asyncAfter on the button Save do work cos the view will be first dismissed and then the values are updated. See code for better context: .toolbar {      Button("Save") { shouldSave.toogle()     self.presentationMode.wrappedValue.dismiss()      } }.onDisappear { guard shouldSave else { return }      author.name = authorName       if isValidAuthor(author) {           dataModel.authors.append(author)       } }
Sep ’21
Reply to SwiftUI crash: AttributeGraph precondition failure
Hi, I experienced this horrible problem and in my case was when using TabView. I have TabView in my ContentView and then one of the List views inside had a NavigationView At the beginning I thought it was something wrong with my code cos was working previously. But after struggling a while. I moved the NavigationView to wrap the whole TabView and that fixed the issue. So I will write here both examples the Non working one and the fix I did in case that might help others. Problematic Code struct ContentView: View {     @EnvironmentObject var dataModel: DataModel     var body: some View { TabView {                 LibraryList()                     .tabItem {                         Label(L10n.library, systemImage: Images.System.library)                     }                 SettingsList()                     .tabItem {                         Label(L10n.more, systemImage: Images.System.more )                     }             } } } struct LibraryList: View {     @EnvironmentObject var dataModel: DataModel     var body: some View { NavigationView { // This navigation here seems to be the issue         List(dataModel.books) { book in NavigationLink(destination: Text("Book")) { // The crash seems to complain here. Text("Book name: \(book.name)") } } } } } The working solution struct ContentView: View {     @EnvironmentObject var dataModel: DataModel     var body: some View { NavigationView { // Moved navigation view before TabView. TabView {                 LibraryList()                     .tabItem {                         Label(L10n.library, systemImage: Images.System.library)                     }                 SettingsList()                     .tabItem {                         Label(L10n.more, systemImage: Images.System.more )                     }             } } } } struct LibraryList: View {     @EnvironmentObject var dataModel: DataModel     var body: some View {         List(dataModel.books) { book in NavigationLink(destination: Text("Book")) { // The crash seems to complain here. Text("Book name: \(book.name)") } } } } I hope this helps some of you.
Sep ’21