Supports filtering apps in BrowseViewController by category

This commit is contained in:
Riley Testut
2023-12-07 18:11:25 -06:00
committed by Magesh K
parent 1b8daa59c0
commit 20b424c97c
2 changed files with 99 additions and 1 deletions

View File

@@ -594,6 +594,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")