@@ -60,9 +60,14 @@ class ViewController: UIViewController {
60
60
### Properties
61
61
62
62
``` swift
63
- var magneticDelegate: MagneticDelegate? // Delegate
64
- var allowsMultipleSelection: Bool // Defaults to true
65
- var selectedChildren: [Node] // Currently selected nodes
63
+ /// Delegate to handle node interactions
64
+ var magneticDelegate: MagneticDelegate?
65
+
66
+ /// Enables multiple node selection (default: true)
67
+ var allowsMultipleSelection: Bool
68
+
69
+ /// Returns all currently selected nodes
70
+ var selectedChildren: [Node]
66
71
```
67
72
68
73
---
@@ -104,6 +109,7 @@ override func deselectedAnimation() {
104
109
105
110
override func removedAnimation (completion : @escaping () -> Void ) {
106
111
// Customize removal animation
112
+ // Call completion() when done
107
113
}
108
114
```
109
115
@@ -133,12 +139,18 @@ Subclass `Node` to define your own behavior or visuals:
133
139
class ImageNode : Node {
134
140
override var image: UIImage? {
135
141
didSet {
142
+ // Update the texture when the image changes
136
143
texture = image.map { SKTexture (image : $0 ) }
137
144
}
138
145
}
139
146
140
- override func selectedAnimation () {}
141
- override func deselectedAnimation () {}
147
+ override func selectedAnimation () {
148
+ // Define custom behavior when the node is selected
149
+ }
150
+
151
+ override func deselectedAnimation () {
152
+ // Define custom behavior when the node is deselected
153
+ }
142
154
}
143
155
```
144
156
0 commit comments