File tree Expand file tree Collapse file tree 3 files changed +3
-3
lines changed Expand file tree Collapse file tree 3 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ Here's a basic implementation in Swift:
26
26
public class TreeNode <T > {
27
27
public var value: T
28
28
29
- public var parent: TreeNode?
29
+ public weak var parent: TreeNode?
30
30
public var children = [TreeNode< T> ]()
31
31
32
32
public init (value : T) {
Original file line number Diff line number Diff line change 3
3
public class TreeNode < T> {
4
4
public var value : T
5
5
6
- public var parent : TreeNode ?
6
+ public weak var parent : TreeNode ?
7
7
public var children = [ TreeNode < T > ] ( )
8
8
9
9
public init ( value: T ) {
Original file line number Diff line number Diff line change 1
1
public class TreeNode < T> {
2
2
public var value : T
3
3
4
- public var parent : TreeNode ?
4
+ public weak var parent : TreeNode ?
5
5
public var children = [ TreeNode < T > ] ( )
6
6
7
7
public init ( value: T ) {
You can’t perform that action at this time.
0 commit comments