@@ -60,7 +60,7 @@ public class BadgeHub: NSObject {
6060 private var isIndeterminateMode = false
6161
6262 // MARK: - SETUP
63- init ( view: UIView ) {
63+ public init ( view: UIView ) {
6464 super. init ( )
6565
6666 maxCount = 100000
@@ -76,7 +76,7 @@ public class BadgeHub: NSObject {
7676 // }
7777
7878 // Adjustment methods
79- func setView( _ view: UIView ? , andCount startCount: Int ) {
79+ public func setView( _ view: UIView ? , andCount startCount: Int ) {
8080 curOrderMagnitude = 0
8181
8282 let frame : CGRect ? = view? . frame
@@ -106,7 +106,7 @@ public class BadgeHub: NSObject {
106106 }
107107
108108 // Set the frame of the notification circle relative to the button
109- func setCircleAtFrame( _ frame: CGRect ) {
109+ public func setCircleAtFrame( _ frame: CGRect ) {
110110 redCircle. frame = frame
111111 initialCenter = CGPoint ( x: frame. origin. x + frame. size. width / 2 , y: frame. origin. y + frame. size. height / 2 )
112112 baseFrame = frame
@@ -118,29 +118,28 @@ public class BadgeHub: NSObject {
118118 }
119119
120120 // Change the color of the notification circle
121- func setCircleColor( _ circleColor: UIColor ? , label labelColor: UIColor ? ) {
121+ public func setCircleColor( _ circleColor: UIColor ? , label labelColor: UIColor ? ) {
122122 redCircle. isUserChangingBackgroundColor = true
123123 redCircle. backgroundColor = circleColor
124124 if let labelColor = labelColor {
125125 countLabel? . textColor = labelColor
126126 }
127127 }
128128
129- func setCircleBorderColor( _ color: UIColor ? , borderWidth width: CGFloat ) {
129+ public func setCircleBorderColor( _ color: UIColor ? , borderWidth width: CGFloat ) {
130130 redCircle. layer. borderColor = color? . cgColor
131131 redCircle. layer. borderWidth = width
132132 }
133133
134-
135- func moveCircleBy( x: CGFloat , y: CGFloat ) {
134+ public func moveCircleBy( x: CGFloat , y: CGFloat ) {
136135 var frame : CGRect = redCircle. frame
137136 frame. origin. x += x
138137 frame. origin. y += y
139138 self . setCircleAtFrame ( frame)
140139 }
141140
142141 // Changes the size of the circle. setting a scale of 1 has no effect
143- func scaleCircleSize( by scale: CGFloat ) {
142+ public func scaleCircleSize( by scale: CGFloat ) {
144143 let fr : CGRect = initialFrame
145144 let width : CGFloat = fr. size. width * scale
146145 let height : CGFloat = fr. size. height * scale
@@ -152,41 +151,41 @@ public class BadgeHub: NSObject {
152151 }
153152
154153 // Increases count by 1
155- func increment( ) {
154+ public func increment( ) {
156155 increment ( by: 1 )
157156 }
158157
159158 // Increases count by amount
160- func increment( by amount: Int ) {
159+ public func increment( by amount: Int ) {
161160 count += amount
162161 }
163162
164163 // Decreases count
165- func decrement( ) {
164+ public func decrement( ) {
166165 decrement ( by: 1 )
167166 }
168167
169168 // Decreases count by amount
170- func decrement( by amount: Int ) {
169+ public func decrement( by amount: Int ) {
171170 if amount >= count {
172171 count = 0
173172 return
174173 }
175174 count -= amount
176175 }
177176
178- func hideCount( ) {
177+ public func hideCount( ) {
179178 countLabel? . isHidden = true
180179 isIndeterminateMode = true
181180 }
182181
183- func showCount( ) {
182+ public func showCount( ) {
184183 isIndeterminateMode = false
185184 checkZero ( )
186185 }
187186
188187 // Animations
189- func pop( ) {
188+ public func pop( ) {
190189 let height = baseFrame. size. height
191190 let width = baseFrame. size. width
192191 let popStartHeight : Float = Float ( height * popStartRatio)
@@ -273,7 +272,7 @@ public class BadgeHub: NSObject {
273272 }
274273 }
275274
276- func blink( ) {
275+ public func blink( ) {
277276 self . setAlpha ( alpha: Float ( blinkAlpha) )
278277
279278 UIView . animate ( withDuration: TimeInterval ( blinkDuration) , animations: {
@@ -290,7 +289,7 @@ public class BadgeHub: NSObject {
290289 }
291290
292291 // Animation that jumps similar to OSX dock icons
293- func bump( ) {
292+ public func bump( ) {
294293 if !initialCenter. equalTo ( redCircle. center) {
295294 // canel previous animation
296295 }
@@ -313,9 +312,8 @@ public class BadgeHub: NSObject {
313312 }
314313 }
315314
316-
317315 // Set the count yourself
318- func setCount( _ newCount: Int ) {
316+ public func setCount( _ newCount: Int ) {
319317 count = newCount
320318
321319 var labelText = " \( NSNumber ( value: count) ) "
@@ -330,28 +328,28 @@ public class BadgeHub: NSObject {
330328 }
331329
332330 // Set the font of the label
333- func setCountLabel( _ font: UIFont ? ) {
331+ public func setCountLabel( _ font: UIFont ? ) {
334332 countLabel? . font = font
335333 }
336334
337- func countLabelFont( ) -> UIFont ? {
335+ public func countLabelFont( ) -> UIFont ? {
338336 return countLabel? . font
339337 }
340338
341339
342- func bumpCenterY( yVal: Float ) {
340+ public func bumpCenterY( yVal: Float ) {
343341 var center : CGPoint = redCircle. center
344342 center. y = initialCenter. y - CGFloat( yVal)
345343 redCircle. center = center
346344 countLabel? . center = center
347345 }
348346
349- func setAlpha( alpha: Float ) {
347+ public func setAlpha( alpha: Float ) {
350348 redCircle. alpha = CGFloat ( alpha)
351349 countLabel? . alpha = CGFloat ( alpha)
352350 }
353351
354- func checkZero( ) {
352+ public func checkZero( ) {
355353 if count <= 0 {
356354 redCircle. isHidden = true
357355 countLabel? . isHidden = true
0 commit comments