Supports filtering apps in BrowseViewController by category

This commit is contained in:
Riley Testut
2023-12-07 18:11:25 -06:00
parent 2681cc3a8e
commit 16f8675d19
2 changed files with 99 additions and 1 deletions

View File

@@ -461,6 +461,13 @@ public extension StoreApp
return predicate
}
class var otherCategoryPredicate: NSPredicate {
let knownCategories = StoreCategory.allCases.lazy.filter { $0 != .other }.map { $0.rawValue }
let predicate = NSPredicate(format: "%K == nil OR NOT (%K IN %@)", #keyPath(StoreApp._category), #keyPath(StoreApp._category), Array(knownCategories))
return predicate
}
@nonobjc class func fetchRequest() -> NSFetchRequest<StoreApp>
{
return NSFetchRequest<StoreApp>(entityName: "StoreApp")