I think var value: T = nil
is causing error below because XCode can't convert nil
value to the generic type T.
class Node<T> {
var value: T = nil
var next: Node
init(value: T) {
self.value = value
self.next = Node()
}
init() {
self.next = Node()
}
}
The error message reads
Could not find an overload for '_coversion' that accepts the supplied arguments
Is there a way to assign nil
value to a variable in Swift?