// // AdvancedKeys.swift // TuskerPreferences // // Created by Shadowfacts on 4/13/24. // import Foundation import Pachyderm struct StatusContentTypeKey: MigratablePreferenceKey { static var defaultValue: StatusContentType { .plain } } struct FeatureFlagsKey: MigratablePreferenceKey, CustomCodablePreferenceKey { static var defaultValue: Set { [] } static func encode(value: Set, to encoder: any Encoder) throws { var container = encoder.singleValueContainer() try container.encode(value.map(\.rawValue)) } static func decode(from decoder: any Decoder) throws -> Set? { let container = try decoder.singleValueContainer() let names = try container.decode([String].self) return Set(names.compactMap(FeatureFlag.init(rawValue:))) } }