I need container for Any Equatable
items in NOT Generic
class (for example UI classes initial from storyboard). I need like this
var items: [Equatable]?
but it don't work, Equatable
need Generic. the problem that there is no exist common Equatable
class.
Ok - Go to generic! But if I do this
class Item<Value: Equatable>: Equatable {
var value: Value
init(_ value: Value) {
self.value = value
}
//Equatable
public static func ==(lhs: Item, rhs: Item) -> Bool {
return (lhs.value == rhs.value)
}
}
then I will be forced to specify the type in my nonGeneric-UI class. Like this
var items: [Item<WhatShouldBeHere?>]?
but again we come to the problem that there is no exist common Equatable
class
Any solutions for container for All Equatable?