Post

Replies

Boosts

Views

Activity

SwiftUI reuses List View when it should draw a completely different one (possible bug?)
I created a List for a settings menu with two sections where you can reorder/add/remove a set of pages. It should work similar to Apple's Today Widget editing menu where you can add and reorder items.Connector class code snippet:class SettingsConnector: ObservableObject { enum DetailsPage { case page1 case page2 case page3 func printed() -> String { switch self { case .page1: return "Page 1" case .page2: return "Page 2" case .page3: return "Page 3" } } } @Published var detailsPages: [DetailsPage] = [.page1, .page2] @Published var hiddenDetailsPages: [DetailsPage] = [.page3] }SwiftUI code snippet:List { Section { ForEach(self.connector.detailsPages, id: \.self) { page in HStack(spacing: 0) { Text("\(page.printed())") Spacer() } } .onMove { (source, destination) in self.connector.detailsPages.move(fromOffsets: source, toOffset: destination) } .onDelete { (rows) in rows.forEach { (i) in let page: SettingsConnector.DetailsPage = self.connector.detailsPages[i] self.connector.detailsPages.remove(at: i) self.connector.hiddenDetailsPages.insert(page, at: 0 } } } Section { ForEach(self.connector.hiddenDetailsPages, id: \.self) { page in HStack(spacing: 0) { Image(systemName: "plus.circle.fill") .foregroundColor(.green) .padding(.horizontal, 5) Text("Add \(page.printed())") .padding(.horizontal, 5) Spacer() } } } }When I delete a page on the first section, it does appear in the hiddenDetailsPages sections.However, even though there is no direct relation between the sections, the cell view is just moved to the second section but using the drawing code from the first section. The drawing instructions from the second section are simply not used even though the cell appears in that section.Am I getting something completely wrong or is this a bug in SwiftUI?
5
0
2.3k
Apr ’20
Big Sur Messages and Spotlight not working at all
Recently I installed Big Sur on my 2017 MacBook Pro 13" and at first everything worked fine. However, since a few days I am unable to start the Messages App. It just keeps jumping in the dock but it never opens. Notifications for new messages do arrive though, it just cannot be opened. Maybe it is related, maybe not, but Spotlight also stopped working. I can open up the search bar but whatever I type there is never a result displayed. Nothing. Really frustrating, is anyone having these issues or even knows a fix to this?
20
0
8k
Nov ’20
WidgetKit Widgets not showing up on iOS 17
Hi, I have a set of Widgets that have worked flawlessly on Xcode 14 and iOS 16, both on Simulator and Device. With Xcode 15 beta (4), these widgets simply don't show up anymore on the iOS 17 Simulator, and I feel like I've tried everything. Then again, building with the new Xcode 15 beta on any iOS 16 or 15 simulator works fine and the widgets are available. They're just gone on iOS 17.0. When I add a new widget extension however it shows up immediately on the iOS 17 simulator. I've compared every single line on the Build Settings and couldn't find any difference there. I have also updated the SiriKit Intent to an AppIntent with no success. Anyone experiencing the same issue? Or any clue on what I could have missed?
2
3
1.6k
Jul ’23