Skip to content

Commit 43ac6a2

Browse files
committed
Fix SwiftData DB path when not using a container (unsigned app build)
1 parent a93b2e5 commit 43ac6a2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Commandoak.xcodeproj/xcshareddata/xcschemes/Commandoak.xcscheme

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@
4949
ReferencedContainer = "container:Commandoak.xcodeproj">
5050
</BuildableReference>
5151
</BuildableProductRunnable>
52+
<CommandLineArguments>
53+
<CommandLineArgument
54+
argument = "-com.apple.CoreData.SQLDebug 1"
55+
isEnabled = "NO">
56+
</CommandLineArgument>
57+
</CommandLineArguments>
5258
</LaunchAction>
5359
<ProfileAction
5460
buildConfiguration = "Release"

Commandoak/CommandoakApp.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ struct CommandoakApp: App {
1212
let schema = Schema([
1313
Command.self
1414
])
15-
let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
15+
let fileUrl = URL.applicationSupportDirectory.appending(path: "Commandoak/commands.store")
16+
let modelConfiguration = ModelConfiguration("Commands", schema: schema, url: fileUrl)
1617

1718
do {
1819
return try ModelContainer(for: schema, configurations: [modelConfiguration])

0 commit comments

Comments
 (0)