mirror of
https://github.com/mastodon/mastodon-ios.git
synced 2024-12-08 14:46:42 +01:00
21 lines
435 B
Swift
21 lines
435 B
Swift
//
|
|
// NSManagedObjectContext.swift
|
|
// Mastodon
|
|
//
|
|
// Created by MainasuK Cirno on 2021-3-11.
|
|
//
|
|
|
|
import Foundation
|
|
import CoreData
|
|
|
|
extension NSManagedObjectContext {
|
|
public func safeFetch<T>(_ request: NSFetchRequest<T>) -> [T] where T : NSFetchRequestResult {
|
|
do {
|
|
return try fetch(request)
|
|
} catch {
|
|
assertionFailure(error.localizedDescription)
|
|
return []
|
|
}
|
|
}
|
|
}
|