Protocols can have associatedtypes which would just need to be adhered to in any subclass:
enum MyEnum: String {
case foo
case bar
}
protocol RequiresEnum {
associatedtype SomeEnumType: RawRepresentable where SomeEnumType.RawValue: StringProtocol
func doSomethingWithEnum(someEnumType: SomeEnumType)
}
class MyRequiresEnum: RequiresEnum {
typealias SomeEnumType = MyEnum
func doSomethingWithEnum(someEnumType: SomeEnumType) {
switch someEnumType {
case .foo:
print("foo")
case .bar:
print("bar")
}
}
}
let mre = MyRequiresEnum()
mre.doSomethingWithEnum(someEnumType: .bar)
Edit: The associatedtype must be adhered to