1
0
mirror of https://github.com/mastodon/mastodon-ios.git synced 2024-12-15 02:14:50 +01:00
mastodon-app-ufficiale-ipho.../CoreDataStack/Extension/URL.swift
2021-01-27 14:50:13 +08:00

24 lines
687 B
Swift

//
// URL.swift
// CoreDataStack
//
// Created by Cirno MainasuK on 2021-1-27.
//
import Foundation
public extension URL {
/// Returns a URL for the given app group and database pointing to the sqlite database.
static func storeURL(for appGroup: String, databaseName: String) -> URL {
guard let fileContainer = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroup) else {
fatalError("Shared file container could not be created.")
}
return fileContainer
.appendingPathComponent("Databases", isDirectory: true)
.appendingPathComponent("\(databaseName).sqlite")
}
}