Skip to content

Commit 55be164

Browse files
authored
Merge pull request #79 from darecki/public_open
Changed public interface to open to allow subclassing
2 parents 869b662 + 988915d commit 55be164

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

Sources/M13Checkbox.swift

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import UIKit
1515

1616
/// A customizable checkbox control for iOS.
1717
@IBDesignable
18-
public class M13Checkbox: UIControl {
18+
open class M13Checkbox: UIControl {
1919

2020
//----------------------------
2121
// MARK: - Constants
@@ -262,20 +262,20 @@ public class M13Checkbox: UIControl {
262262
//----------------------------
263263

264264
/// The object to return from `value` when the checkbox is checked.
265-
public var checkedValue: Any?
265+
open var checkedValue: Any?
266266

267267
/// The object to return from `value` when the checkbox is unchecked.
268-
public var uncheckedValue: Any?
268+
open var uncheckedValue: Any?
269269

270270
/// The object to return from `value` when the checkbox is mixed.
271-
public var mixedValue: Any?
271+
open var mixedValue: Any?
272272

273273
/**
274274
Returns one of the three "value" properties depending on the checkbox state.
275275
- returns: The value coresponding to the checkbox state.
276276
- note: This is a convenience method so that if one has a large group of checkboxes, it is not necessary to write: if (someCheckbox == thatCheckbox) { if (someCheckbox.checkState == ...
277277
*/
278-
public var value: Any? {
278+
open var value: Any? {
279279
switch checkState {
280280
case .unchecked:
281281
return uncheckedValue
@@ -291,7 +291,7 @@ public class M13Checkbox: UIControl {
291291
//----------------------------
292292

293293
/// The current state of the checkbox.
294-
public var checkState: CheckState {
294+
open var checkState: CheckState {
295295
get {
296296
return controller.state
297297
}
@@ -305,7 +305,7 @@ public class M13Checkbox: UIControl {
305305
- parameter checkState: The new state of the checkbox.
306306
- parameter animated: Whether or not to animate the change.
307307
*/
308-
public func setCheckState(_ newState: CheckState, animated: Bool) {
308+
open func setCheckState(_ newState: CheckState, animated: Bool) {
309309
if checkState == newState {
310310
return
311311
}
@@ -329,7 +329,7 @@ public class M13Checkbox: UIControl {
329329
- parameter animated: Whether or not to animate the change. Defaults to false.
330330
- note: If the checkbox is mixed, it will return to the unchecked state.
331331
*/
332-
public func toggleCheckState(_ animated: Bool = false) {
332+
open func toggleCheckState(_ animated: Bool = false) {
333333
switch checkState {
334334
case .checked:
335335
setCheckState(.unchecked, animated: animated)
@@ -348,7 +348,7 @@ public class M13Checkbox: UIControl {
348348
//----------------------------
349349

350350
/// The duration of the animation that occurs when the checkbox switches states. The default is 0.3 seconds.
351-
@IBInspectable public var animationDuration: TimeInterval {
351+
@IBInspectable open var animationDuration: TimeInterval {
352352
get {
353353
return controller.animationGenerator.animationDuration
354354
}
@@ -358,7 +358,7 @@ public class M13Checkbox: UIControl {
358358
}
359359

360360
/// The type of animation to preform when changing from the unchecked state to any other state.
361-
public var stateChangeAnimation: Animation = .stroke {
361+
open var stateChangeAnimation: Animation = .stroke {
362362
didSet {
363363

364364
// Remove the sublayers
@@ -395,7 +395,7 @@ public class M13Checkbox: UIControl {
395395
}
396396

397397
/// Whether or not to enable morphing between states.
398-
@IBInspectable public var enableMorphing: Bool {
398+
@IBInspectable open var enableMorphing: Bool {
399399
get {
400400
return controller.enableMorphing
401401
}
@@ -425,7 +425,7 @@ public class M13Checkbox: UIControl {
425425
//----------------------------
426426

427427
/// The color of the checkbox's tint color when not in the unselected state. The tint color is is the main color used when not in the unselected state.
428-
@IBInspectable public var secondaryTintColor: UIColor? {
428+
@IBInspectable open var secondaryTintColor: UIColor? {
429429
get {
430430
return controller.secondaryTintColor
431431
}
@@ -435,7 +435,7 @@ public class M13Checkbox: UIControl {
435435
}
436436

437437
/// The color of the checkmark when it is displayed against a filled background.
438-
@IBInspectable public var secondaryCheckmarkTintColor: UIColor? {
438+
@IBInspectable open var secondaryCheckmarkTintColor: UIColor? {
439439
get {
440440
return controller.secondaryCheckmarkTintColor
441441
}
@@ -445,7 +445,7 @@ public class M13Checkbox: UIControl {
445445
}
446446

447447
/// The stroke width of the checkmark.
448-
@IBInspectable public var checkmarkLineWidth: CGFloat {
448+
@IBInspectable open var checkmarkLineWidth: CGFloat {
449449
get {
450450
return controller.pathGenerator.checkmarkLineWidth
451451
}
@@ -456,7 +456,7 @@ public class M13Checkbox: UIControl {
456456
}
457457

458458
/// The type of mark to display.
459-
@IBInspectable public var markType: MarkType {
459+
@IBInspectable open var markType: MarkType {
460460
get {
461461
return controller.markType
462462
}
@@ -467,12 +467,12 @@ public class M13Checkbox: UIControl {
467467
}
468468

469469
/// Set the mark type with the option of animating the change.
470-
public func setMarkType(markType: MarkType, animated: Bool) {
470+
open func setMarkType(markType: MarkType, animated: Bool) {
471471
controller.setMarkType(type: markType, animated: animated)
472472
}
473473

474474
/// The stroke width of the box.
475-
@IBInspectable public var boxLineWidth: CGFloat {
475+
@IBInspectable open var boxLineWidth: CGFloat {
476476
get {
477477
return controller.pathGenerator.boxLineWidth
478478
}
@@ -483,7 +483,7 @@ public class M13Checkbox: UIControl {
483483
}
484484

485485
/// The corner radius of the box if the box type is square.
486-
@IBInspectable public var cornerRadius: CGFloat {
486+
@IBInspectable open var cornerRadius: CGFloat {
487487
get {
488488
return controller.pathGenerator.cornerRadius
489489
}
@@ -494,7 +494,7 @@ public class M13Checkbox: UIControl {
494494
}
495495

496496
/// The shape of the checkbox.
497-
public var boxType: BoxType {
497+
open var boxType: BoxType {
498498
get {
499499
return controller.pathGenerator.boxType
500500
}
@@ -505,7 +505,7 @@ public class M13Checkbox: UIControl {
505505
}
506506

507507
/// Wether or not to hide the checkbox.
508-
@IBInspectable public var hideBox: Bool {
508+
@IBInspectable open var hideBox: Bool {
509509
get {
510510
return controller.hideBox
511511
}
@@ -514,7 +514,7 @@ public class M13Checkbox: UIControl {
514514
}
515515
}
516516

517-
public override func tintColorDidChange() {
517+
open override func tintColorDidChange() {
518518
super.tintColorDidChange()
519519
controller.tintColor = tintColor
520520
}
@@ -523,7 +523,7 @@ public class M13Checkbox: UIControl {
523523
// MARK: - Layout
524524
//----------------------------
525525

526-
public override func layoutSubviews() {
526+
open override func layoutSubviews() {
527527
super.layoutSubviews()
528528
// Update size
529529
controller.pathGenerator.size = min(frame.size.width, frame.size.height)

0 commit comments

Comments
 (0)