Post

Replies

Boosts

Views

Activity

@FetchRequest doesn't respect fetchBatchSize
Hello, I am building a list in SwiftUI, using the @FetchRequest property wrapper to fetch core data entities, taking as input a fetch request which has the property fetchBatchSize set to 50. import SwiftUI import CoreData extension Item { static var listRequest: NSFetchRequest<Item> { let request = Item.fetchRequest() request.fetchBatchSize = 50 request.sortDescriptors = [NSSortDescriptor(keyPath: \Item.timestamp, ascending: true)] return request } } struct ContentView: View { @Environment(\.managedObjectContext) private var viewContext @FetchRequest(fetchRequest: Item.listRequest) private var items: FetchedResults<Item> var body: some View { NavigationView { List { ForEach(items) { item in Text(item.timestamp!, formatter: itemFormatter) } } } } } But when loading my list with 3000 items and having the argument -com.apple.CoreData.SQLDebug enabled, there are 241 calls made to load my items 50 by 50 at a time. There is no mention of fetchBatchSize in the documentation, but this feature of fetch request is really important to me when building App dealing with large datasets of objects. Am I doing something wrong or is there any recommandation about large data sets performances with SwiftUI lists indicating the best practices? Thanks for your help !
0
1
524
Aug ’23
Can’t archive App that uses a swift package with an xcframework
Hello, We have a situation where: we have a library A distributed as an xcframework. this library A is used in a swift package B that includes it as a binary target. our final iOS App uses our swift package B with swift package manager. We first had issues with code signing and solved it by adding a build phase that code sign the framework A when building the App. Now everything is fine when running in debug but when trying to archive the App, We have a compilation error saying Xcode doesn’t find the framework A.. we try a lots of different setup but didn’t find any solution to fix this compilation error. Any idea on how we could solve this issue? Thanks!
18
1
12k
Oct ’21
@FetchRequest doesn't respect fetchBatchSize
Hello, I am building a list in SwiftUI, using the @FetchRequest property wrapper to fetch core data entities, taking as input a fetch request which has the property fetchBatchSize set to 50. import SwiftUI import CoreData extension Item { static var listRequest: NSFetchRequest<Item> { let request = Item.fetchRequest() request.fetchBatchSize = 50 request.sortDescriptors = [NSSortDescriptor(keyPath: \Item.timestamp, ascending: true)] return request } } struct ContentView: View { @Environment(\.managedObjectContext) private var viewContext @FetchRequest(fetchRequest: Item.listRequest) private var items: FetchedResults<Item> var body: some View { NavigationView { List { ForEach(items) { item in Text(item.timestamp!, formatter: itemFormatter) } } } } } But when loading my list with 3000 items and having the argument -com.apple.CoreData.SQLDebug enabled, there are 241 calls made to load my items 50 by 50 at a time. There is no mention of fetchBatchSize in the documentation, but this feature of fetch request is really important to me when building App dealing with large datasets of objects. Am I doing something wrong or is there any recommandation about large data sets performances with SwiftUI lists indicating the best practices? Thanks for your help !
Replies
0
Boosts
1
Views
524
Activity
Aug ’23
Can’t archive App that uses a swift package with an xcframework
Hello, We have a situation where: we have a library A distributed as an xcframework. this library A is used in a swift package B that includes it as a binary target. our final iOS App uses our swift package B with swift package manager. We first had issues with code signing and solved it by adding a build phase that code sign the framework A when building the App. Now everything is fine when running in debug but when trying to archive the App, We have a compilation error saying Xcode doesn’t find the framework A.. we try a lots of different setup but didn’t find any solution to fix this compilation error. Any idea on how we could solve this issue? Thanks!
Replies
18
Boosts
1
Views
12k
Activity
Oct ’21