func showDatabase(modelContainer: ModelContainer) { for configuration in modelContainer.configurations { let modelURL = configuration.url printFileInfo(at: modelURL.path(percentEncoded: false)) if let url = URL(string: modelURL.absoluteString + "-wal") { printFileInfo(at: url.path(percentEncoded: false)) } if let url = URL(string: modelURL.absoluteString + "-shm") { printFileInfo(at: url.path(percentEncoded: false)) } let modelBaseName = modelURL.deletingPathExtension().lastPathComponent let url = modelURL.deletingLastPathComponent().appending(path: ".\(modelBaseName)_SUPPORT") guard let directoryEnumerator = FileManager.default.enumerator(at: url, includingPropertiesForKeys: nil) else { return } for case let fileURL as URL in directoryEnumerator { printFileInfo(at: fileURL.path(percentEncoded: false)) } } } func printFileInfo(at path: String) { if let attributes = try? FileManager.default.attributesOfItem(atPath: path) { let fileSize = attributes[FileAttributeKey.size] as! UInt64 print("\(path) - \(fileSize) bytes") } }