8
8
9
9
import UIKit
10
10
11
- class DisplayNodeCanvas : UIScrollView , UIScrollViewDelegate {
11
+ public class DisplayNodeCanvas : UIScrollView , UIScrollViewDelegate {
12
12
/// List of all nodes in the canvas.
13
- var nodes : [ DisplayNode ]
13
+ public private ( set ) var nodes : [ DisplayNode ]
14
14
15
15
/// View that is drawn behind all other views.
16
16
var backgroundView : UIView ? {
@@ -33,7 +33,7 @@ class DisplayNodeCanvas: UIScrollView, UIScrollViewDelegate {
33
33
var updateCallback : ( ( ) -> Void ) ?
34
34
35
35
/// The starting node that all other nodes build off of.
36
- var baseNode : DisplayNode !
36
+ public private ( set ) var baseNode : DisplayNode !
37
37
38
38
override init ( frame: CGRect ) {
39
39
// Create new node list
@@ -73,17 +73,17 @@ class DisplayNodeCanvas: UIScrollView, UIScrollViewDelegate {
73
73
contentOffset = CGPoint ( x: contentSize. width / 2 - 200 , y: contentSize. height / 2 - 200 )
74
74
}
75
75
76
- required init ? ( coder aDecoder: NSCoder ) {
76
+ public required init ? ( coder aDecoder: NSCoder ) {
77
77
fatalError ( " init(coder:) has not been implemented " )
78
78
}
79
79
80
- override func layoutSubviews( ) {
80
+ public override func layoutSubviews( ) {
81
81
// Resize all views
82
82
backgroundView? . frame. size = bounds. size
83
83
overlayView. frame. size = bounds. size
84
84
}
85
85
86
- func scrollViewDidScroll( _ scrollView: UIScrollView ) {
86
+ public func scrollViewDidScroll( _ scrollView: UIScrollView ) {
87
87
// Move the background and overlay with the view
88
88
backgroundView? . frame. origin = scrollView. contentOffset
89
89
overlayView. frame. origin = scrollView. contentOffset
@@ -93,7 +93,7 @@ class DisplayNodeCanvas: UIScrollView, UIScrollViewDelegate {
93
93
}
94
94
95
95
/// Assembles all of the code.
96
- func assemble( ) -> String {
96
+ public func assemble( ) -> String {
97
97
var output = " "
98
98
99
99
// Assemble each function
@@ -109,7 +109,7 @@ class DisplayNodeCanvas: UIScrollView, UIScrollViewDelegate {
109
109
}
110
110
111
111
/// Adds a node to the canvas.
112
- func insert( node: DisplayNode , at position: CGPoint , absolutePosition: Bool = false ) {
112
+ public func insert( node: DisplayNode , at position: CGPoint , absolutePosition: Bool = false ) {
113
113
assert ( !nodes. contains ( node) )
114
114
assert ( node. canvas == nil )
115
115
@@ -139,7 +139,7 @@ class DisplayNodeCanvas: UIScrollView, UIScrollViewDelegate {
139
139
140
140
/// Called when any interaction occurs with the node and it needs to be
141
141
/// updated.
142
- func updated( node: DisplayNode ) {
142
+ public func updated( node: DisplayNode ) {
143
143
// Bring node to front under overlay
144
144
bringSubview ( toFront: node)
145
145
bringSubview ( toFront: overlayView)
@@ -155,7 +155,7 @@ class DisplayNodeCanvas: UIScrollView, UIScrollViewDelegate {
155
155
}
156
156
157
157
/// Removes a ndoe from the canvas.
158
- func remove( node: DisplayNode ) {
158
+ public func remove( node: DisplayNode ) {
159
159
assert ( nodes. contains ( node) )
160
160
assert ( node. canvas == self )
161
161
0 commit comments