vds_ios/VDS/Protocols/EnumSubset.swift
Bandaru, Krishna Kishore 25713cd533 Tilelet Enhancements
2024-03-26 16:54:50 +00:00

22 lines
463 B
Swift

//
// EnumSubset.swift
// VDS
//
// Created by Matt Bruce on 12/19/22.
//
import Foundation
public protocol EnumSubset<T>: RawRepresentable, CaseIterable, Valuing {
associatedtype T:RawRepresentable
var defaultValue: T { get }
}
extension EnumSubset where RawValue == T.RawValue {
/// Will either return the Generic RawRepresentable object or the defaultValue
public var value: T {
T(rawValue: rawValue) ?? defaultValue
}
}