Renaming SwiftData model causing an error

I'm still working on version 1.0.0 of my app so don't yet need to migrate swiftdata versions. I renamed my data model(s) but I get this error when running the app after changing the name of the model from SectionsSD to HelpSection

error: the replacement path doesn't exist: "/var/folders/fk/m2x_2qzj44508m9zzcll2j_w0000gn/T/swift-generated-sources/@__swiftmacro_11OpExShellV112FilteredListV11helpSection5QueryfMa_.swift"

Despite cleaning the build, deleting the derived data and deleting the app and data on the simulator (and resetting it) I still get the replacement path error whenever I run the app in the simulator.

When I run this code against the model I get the error:

    @Query var helpSection: [HelpSection]
    
    let searchString: String
    let isExpanded: Bool
    
    var filteredSections: [HelpSection] {
        helpSection.filter { section in
            section.toArticles?.contains { $0.search.contains(searchString) } == true
        }
        .sorted { $0.rank < $1.rank }
    }

deleting derived data, cleaning builds and restarts do not resolve the issue.

This seems to be the same issue discussed in the error: the replacement path doesn't exist: post.

I see it a system bug related to Swift Macro expansion and caching, and would suggest that you file a feedback report – If you do so, please share your report ID for folks to track.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

That suggestion was a dud. I used the following code to delete the store which it did delete but the problem persists:

    if let storeURL = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first?.appendingPathComponent("default.store") {
        do {
            try FileManager.default.removeItem(at: storeURL)
            print("default.store deleted successfully.")
        } catch {
            print("Error deleting default.store: \(error)")
        }
    }

I still get this error:

error: the replacement path doesn't exist: "/var/folders/fk/m2x_2qzj44508m9zzcll2j_w0000gn/T/swift-generated-sources/@__swiftmacro_11OpExShellV112FilteredListV11helpSection33_232B54C76A2ED061EC4416CE3B2A99A1LL5QueryfMa_.swift"

It's got to be hanging on to the tracking or reference somewhere else.

Renaming SwiftData model causing an error
 
 
Q