mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Add Node.existingOrNewChildNode — recycles an existing node. Creates a new node only when needed.
This commit is contained in:
@@ -81,6 +81,14 @@ public final class Node: Hashable {
|
||||
return node
|
||||
}
|
||||
|
||||
public func existingOrNewChildNode(with representedObject: AnyObject) -> Node {
|
||||
|
||||
if let node = childNodeRepresentingObject(representedObject) {
|
||||
return node
|
||||
}
|
||||
return createChildNode(representedObject)
|
||||
}
|
||||
|
||||
public func createChildNode(_ representedObject: AnyObject) -> Node {
|
||||
|
||||
// Just creates — doesn’t add it.
|
||||
|
||||
Reference in New Issue
Block a user