0
У меня есть следующий протоколInt не конвертируется в T
public protocol NumericType {
static func +(lhs: Self, rhs: Self) -> Self
static func addWithOverflow(_ lhs: Self, _ rhs: Self) -> (Self, overflow: Bool)
}
Также я простирающийся Int в соответствие с ним следующим образом
extension Int : NumericType { }
Тогда у меня есть на структуру со следующим определением
struct State<T:NumericType> {
let current : T
init(current : T) {
self.current = current
}
static func initial() -> State<T> {
return State(current: 0) // Int is not convertible to T
}
}