我想声明符合具有特定属性的协议的R> anydate("12/30/2014") # no format needed
[1] "2014-12-30"
R> anydate(as.factor("12/30/2014")) # converts from factor too
[1] "2014-12-30"
R>
,即associatedtype
。
这是我到目前为止所得到的。
RawRepresentable where Self.RawValue == String
但这还不够精确。我需要一个protocol StatefulView: class {
associatedtype StateType: RawRepresentable, Hashable
}
子句,但是我把它放在哪里?