Post

Replies

Boosts

Views

Activity

SwiftUI's List backed by CoreData using @FetchRequest fails to update on iOS 26 when compiled with Xcode 26
Hey there! I've been tracking a really weird behavior with a List backed by @FetchRequest from CoreData. When I toggle a bool on the CoreData model, the first time it updates correctly, but if I do it a second time, the UI doesn't re-render as expected. This does not happen if I compile the app using Xcode 16 (targeting both iOS 18 and iOS 26), nor it happens when using Xcode 26 and targeting iOS 18. It only happens when building the app using Xcode 26 and running it on iOS 26. Here are two demos: the first one works as expected, when I toggle the state twice, both times updates. The second one, only on iOS 26, the second toggle fails to re-render. Demo (running from Xcode 16): Demo (running from Xcode 26): The code: import SwiftUI import CoreData @main struct CoreDataTestApp: App { let persistenceController = PersistenceController.shared var body: some Scene { WindowGroup { ContentView() .environment(\.managedObjectContext, persistenceController.container.viewContext) } } } struct ContentView: View { @Environment(\.managedObjectContext) private var viewContext @FetchRequest(sortDescriptors: [NSSortDescriptor(keyPath: \Item.timestamp, ascending: true)]) private var items: FetchedResults<Item> var body: some View { NavigationView { List { ForEach(items) { item in HStack { Text(item.timestamp!.formatted()) Image(systemName: item.isFavorite ? "heart.fill" : "heart").foregroundStyle(.red) }.swipeActions(edge: .leading, allowsFullSwipe: true) { Button(item.isFavorite ? "Unfavorite" : "Favorite", systemImage: item.isFavorite ? "heart" : "heart.fill") { toggleFavoriteStatus(item: item) } } } } .toolbar { ToolbarItem { Button(action: addItem) { Label("Add Item", systemImage: "plus") } } } } } private func addItem() { withAnimation { let newItem = Item(context: viewContext) newItem.timestamp = Date() newItem.isFavorite = Bool.random() try! viewContext.save() } } private func toggleFavoriteStatus(item: Item) { withAnimation { item.isFavorite.toggle() try! viewContext.save() } } } struct PersistenceController { static let shared = PersistenceController() let container: NSPersistentContainer init() { container = NSPersistentContainer(name: "CoreDataTest") container.loadPersistentStores(completionHandler: { _, _ in }) container.viewContext.automaticallyMergesChangesFromParent = true } }
5
1
233
Sep ’25
TestFlight builds for macOS stuck processing for days without finishing
Hello! I'm encountering a weird issue on TestFlight/AppStoreConnect. I've builds that are in the "Processing" state since the 19th (that's 5 days ago from the date of this post). I've tried to generate new builds to see if it was just a fluke during those days, but new builds generated today also get stuck at processing. It's starting to become an issue because everybody on our team that's not a developer can't test the latest changes... Is there any way that I can get them unstuck? Thanks!
2
1
182
2w
Is there any way to force the presentation of a Share Extension's UIViewController to use UISheetPresentationController?
I'm wondering if there's any way to force the UIViewController presented by a Share Extension to use the UISheetPresentationController introduced in iOS 15? Right now, the only way they're presented is modally, occupying almost the entire screen. Most share extensions don't need that much space and would allow you to have more context from where you shared (the originating app).
1
0
1.9k
Nov ’21
App Store Connect doesn't allow me to include new In App Purchases for review
I'm really struggling with having two new In-App Purchases approved. I've added two new IAPs in the V2 of my app, but for some reason they're never approved, they keep coming back to me with the "Developer Action Needed" error and "We have returned your IAP product/s to you as the required binary was not submitted. When you are ready to submit the binary, please resubmit the IAPs with the binary." I have, indeed, included the code to handle them on the binary being submitted (working fine on dev & TestFlight). I remember that when I added the first ever purchase I had to include it where you select which binary needs to be reviewed, but that option never appears. Here's how it's looking: There's nowhere to select any In-App Purchase to be reviewed with that binary. I've peeked at the console and I'm seeing 404's for a URL that might be exactly what I need, is the App Store Connect just broken right now? I've tried everything and I haven't been able to find what's shown here: https://help.apple.com/app-store-connect/#/dev1986a0e5c
1
0
1.1k
Nov ’21
SwiftUI apps on macOS don't relaunch after being minimized
I've been working on a macOS app using pure SwiftUI, and I've found a strange behavior that I've no idea how to solve. If you have enabled the System Preferences > Dock & Menu Bar > Minimize windows into application icon flag, when you minimize the window it never launches again when clicking the app icon on the dock. This does not happen with an AppKit application. The issue can be seen here (video + 2 sample projects): https://github.com/xmollv/macOSMinimizeIssueOnSwiftUI Literally they're empty apps, just created them using Xcode's assistant (the SwiftUI one has the steps to repro the issue in the UI). The only solution that I found to launch the SwiftUI one is rick clicking the app icon, and then selecting the window, but of course nobody expects that. My question is: is there any way launch a minimized SwiftUI app when clicking the dock icon?
3
0
3.3k
Aug ’22
SwiftData ModelConfigurations always sync to iCloud if one of them has iCloud enabled
I'm facing a weird issue with SwiftData. I want to have one database that's local to the device and one that syncs to iCloud. In this example, LTRLink should be synced via iCloud while LTRMetadata should stay on-device only. I've it configured like the following: let schema = Schema([LTRLink.self, LTRMetadata.self]) let cloudkitConfiguration = ModelConfiguration("Remote", schema: schema, url: FileManager.remoteDatabaseFolderURL.appending(path: "Remote.sqlite"), cloudKitDatabase: .private("iCloud.com.xavimoll.abyss3")) let localConfiguration = ModelConfiguration("Local", schema: schema, url: FileManager.localDatabaseFolderURL.appending(path: "Local.sqlite"), cloudKitDatabase: .none) return try ModelContainer(for: schema, configurations: [cloudkitConfiguration, localConfiguration]) For some reason, when I create the iCloud schema, both models end up appearing as records on iCloud. I create the schema like this: let schema = Schema([LTRLink.self, LTRMetadata.self]) let cloudkitConfiguration = ModelConfiguration("Remote", schema: schema, url: FileManager.remoteDatabaseFolderURL.appending(path: "Remote.sqlite"), cloudKitDatabase: .private("iCloud.com.xavimoll.abyss3")) #if DEBUG // Needed to create the schema on iCloud try autoreleasepool { let desc = NSPersistentStoreDescription(url: cloudkitConfiguration.url) let opts = NSPersistentCloudKitContainerOptions(containerIdentifier: cloudkitConfiguration.cloudKitContainerIdentifier!) desc.cloudKitContainerOptions = opts desc.shouldAddStoreAsynchronously = false if let mom = NSManagedObjectModel.makeManagedObjectModel(for: [LTRLink.self]) { let container = NSPersistentCloudKitContainer(name: "Remote", managedObjectModel: mom) container.persistentStoreDescriptions = [desc] container.loadPersistentStores {_, err in if let err { fatalError(err.localizedDescription) } } try container.initializeCloudKitSchema() if let store = container.persistentStoreCoordinator.persistentStores.first { try container.persistentStoreCoordinator.remove(store) } } } #endif let localConfiguration = ModelConfiguration("Local", schema: schema, url: FileManager.localDatabaseFolderURL.appending(path: "Local.sqlite"), cloudKitDatabase: .none) return try ModelContainer(for: schema, configurations: [cloudkitConfiguration, localConfiguration]) The logic to initialize the CloudKit schema follows the documentation found here: https://developer.apple.com/documentation/swiftdata/syncing-model-data-across-a-persons-devices#Initialize-the-CloudKit-development-schema It looks like setting cloudKitDatabase: .none on the init for the ModelConfiguration doesn't do anything, and ends up being synced with iCloud either way. When I go to the iCloud console, I see the following: Does anyone know if there's any workaround that would allow me to have two databases where only one of them syncs to iCloud when using SwiftData?
1
0
643
Oct ’24
SwiftUI's contextMenu(forSelectionType:menu:primaryAction:) returns an incorrect amount of rows if the selection is manually modified
I'm facing a weird issue with contextMenu(forSelectionType:menu:primaryAction:) attached to a List. It works fine if you enable edit mode, and start selecting the rows by tapping, but if you have a button that what it does is manually modify the selection, the returned rows when the contextMenu is invoked is incorrect. Furthermore, if you use the select all button, but actually scroll to the bottom of the list, the returned values is correct, so it seems that unless the cell is rendered, the contextMenu won't return it. Does anybody know if I'm doing something wrong? Here's a quick example to reproduce the issue: struct ContentView: View {     let rows = (0..<100).map{ "Row: \($0)" }     @State var selection: Set<String> = []     var body: some View {         List(selection: $selection) {             ForEach(rows, id: \.self) { row in                 Text(row).tag(row)             }         }.contextMenu(forSelectionType: String.self) { contextMenuRows in             Button("Number of rows in the contextMenu: \(contextMenuRows.count)") {}         }.toolbar {             ToolbarItem(placement: .navigationBarLeading) {                 if selection.isEmpty {                     Button("Select All") { selection = Set(rows) }                 } else {                     Button("Deselect All") { selection = [] }                 }             }             ToolbarItem(placement: .navigationBarTrailing) {                 EditButton()             }         }     } } Make sure to embed the ContentView inside a NavigationView to be able to see the navigation bar. Video demo showing the issue: https://imgur.com/a/fxKk5Cs Works fine when selecting manually When selecting all only displays the first 9 rows After scrolling, all rows are available to the contextMenu
0
0
1.1k
Sep ’22
Extraneous alignment of a SwiftUI.Menu when animated by the keyboard appearing
I'm facing a weird alignment issue with a floating menu when the keyboard appears and I've no idea if there's a workaround. To reproduce the issue, simply copy and paste this code: struct ContentView: View {     @State var searchQuery = ""          var customToolbarButton: some View {         VStack {             Text("Example").font(.footnote)             Image(systemName: "arrowtriangle.down.fill").imageScale(.small)         }.foregroundColor(.accentColor)     }          var body: some View {         NavigationView {             Rectangle().fill(.red)             .safeAreaInset(edge: .bottom) {                 HStack(alignment: .center) {                     customToolbarButton                     Spacer()                     Menu { } label: {                         customToolbarButton                     }                 }                 .frame(height: 52)                 .padding(.horizontal)                 .background(Color.white)                 .clipShape(Capsule(style: .continuous))             }         }.searchable(text: $searchQuery)     } } When the keyboard appears and moves the HStack up, the views that are a Menu are wrongly placed, all other views seem fine. Any idea if there's a fix? Video to illustrate the issue: https://twitter.com/xmollv/status/1616851571832229889
0
0
667
Jan ’23
Ask Each Time on macOS doesn't not allow empty selection
Hello! I'm facing a strange behavior on macOS related to Ask Each Time, which works fine on iOS. I've an App Intent that declares a parameter like so: @Parameter( title: "Tags", description: "Tags to add to the link.", optionsProvider: TagsOptionsProvider() ) var tags: [String]? The TagsOptionProvider is like this: struct TagsOptionsProvider: DynamicOptionsProvider { @Dependency private var modelCoordinator: ModelCoordinator @MainActor func results() async throws -> [String] { return modelCoordinator.tags().compactMap { $0.name } } } Now, the issue comes if I create a shortcut where for the tags parameter the user selects the magic variable Ask Each Time. On iOS, when the user is presented with the selector, they can simply tap 'Done' without selecting any value (the user does not want to include any tag). The problem is that on macOS the 'Done' button is disabled if there's no selection. See both behaviors: iOS: macOS: Question: Is there a way to let macOS continue even if the user doesn't select any of the available options like on iOS? I've tried declaring the tags para meter as Optional (like on the screenshot) and non-optional, both cases show the same behavior. Environment: iOS 18.5 macOS 15.5
1
0
272
Jul ’25