vds_ios/VDS/Protocols/EnumSubset.swift
Matt Bruce 83e11dcb09 added enumb protocol
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
2022-12-20 08:33:49 -06:00

20 lines
366 B
Swift

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