Closed RodolfoAntonici closed 5 years ago
As we can se in the issue #20, the delegates.count property will count nil references, which would cause the following implementation to fail:
delegates.count
public var isEmpty: Bool { return delegates.count == 0 }
To solve that:
public var isEmpty: Bool { return delegates.allObjects.count == 0 }
This will only count existing objects, nil references won't be indexed in the allObjects.
allObjects
Good finding!
from apple docs:
var allObjects: [ObjectType] The hash table’s members. var count: Int The number of elements in the hash table.
tag: 2.1.3
As we can se in the issue #20, the
delegates.count
property will count nil references, which would cause the following implementation to fail:To solve that:
This will only count existing objects, nil references won't be indexed in the
allObjects
.