mirror of
https://github.com/exyte/Macaw.git
synced 2024-11-11 01:42:35 +03:00
26 lines
394 B
Swift
26 lines
394 B
Swift
|
|
||
|
import UIKit
|
||
|
|
||
|
let nodesMap = NodesMap()
|
||
|
class NodesMap {
|
||
|
var map = [Node: MacawView]()
|
||
|
|
||
|
func add(node: Node, view: MacawView) {
|
||
|
map[node] = view
|
||
|
|
||
|
if let group = node as? Group {
|
||
|
group.contents.forEach { child in
|
||
|
self.add(child, view: view)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func getView(node: Node) -> MacawView? {
|
||
|
return map[node]
|
||
|
}
|
||
|
|
||
|
func remove(node: Node) {
|
||
|
map.removeValueForKey(node)
|
||
|
}
|
||
|
}
|