42 lines
No EOL
1.1 KiB
Swift
42 lines
No EOL
1.1 KiB
Swift
//
|
|
// FeatureProvider.swift
|
|
// KeysForAll
|
|
//
|
|
// Protocol for apps to define their features
|
|
//
|
|
|
|
import Foundation
|
|
|
|
/// Protocol that apps implement to define their features
|
|
public protocol FeatureProvider {
|
|
associatedtype Feature: Hashable & CaseIterable
|
|
|
|
/// All features available in the app
|
|
var allFeatures: [Feature] { get }
|
|
|
|
/// Display name for a feature
|
|
func displayName(for feature: Feature) -> String
|
|
|
|
/// Category for a feature
|
|
func category(for feature: Feature) -> FeatureCategory
|
|
|
|
/// Required license level for a feature
|
|
func requiredLevel(for feature: Feature) -> LicenseLevel
|
|
|
|
/// Optional: Description for a feature
|
|
func description(for feature: Feature) -> String?
|
|
|
|
/// Optional: Icon name for a feature
|
|
func iconName(for feature: Feature) -> String?
|
|
}
|
|
|
|
// Default implementations
|
|
public extension FeatureProvider {
|
|
func description(for feature: Feature) -> String? {
|
|
return nil
|
|
}
|
|
|
|
func iconName(for feature: Feature) -> String? {
|
|
return nil
|
|
}
|
|
} |