Dynamic Core Data with SwiftUI Tutorial for iOS | raywenderlich.com

Learn how to take advantage of all the new Core Data features introduced in iOS 15 to make your SwiftUI apps even more powerful.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/27201015-dynamic-core-data-with-swiftui-tutorial-for-ios

Is there a way to make this work with large data sets?

Below creates 1000 records and the app becomes sluggish and slow to respond, is this a flaw in SwiftUi?

  private func addTestFriends() {
    let request = Friend.fetchRequest()
    let context = PersistenceManager.shared.persistentContainer.viewContext
    do {
      if try context.count(for: request) == 0 {
        for number in 1...1000 {
          print(number)
          try Friend.generateTestFriends(in: context)
        }
      }
    } catch {
      print("Error generating friends: \(error)")
    }
  }

Hi. Do you mean it becomes sluggish while the load is happening or for the entire time after you add the records?