Skip to content

Commit

Permalink
Rename ConstantValues to DefaultValues
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaantonioni committed Jul 30, 2017
1 parent 6ba8903 commit 65be638
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions M13Checkbox/ConstantValues.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
import Foundation

// A set of default values used to initialize the object
struct ConstantValues {
struct DefaultValues {

static let defaultAnimation: M13Checkbox.Animation = .stroke
static let defaultMarkType: M13Checkbox.MarkType = .checkmark
static let defaultBoxType: M13Checkbox.BoxType = .circle
static let defaultCheckState: M13Checkbox.CheckState = .unchecked
static let defaultController: M13CheckboxController = M13CheckboxStrokeController()
static let animation: M13Checkbox.Animation = .stroke
static let markType: M13Checkbox.MarkType = .checkmark
static let boxType: M13Checkbox.BoxType = .circle
static let checkState: M13Checkbox.CheckState = .unchecked
static let controller: M13CheckboxController = M13CheckboxStrokeController()

}
8 changes: 4 additions & 4 deletions Sources/M13Checkbox+IB.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public extension M13Checkbox {
if let type = Animation(rawValue: newValue) {
stateChangeAnimation = type
} else {
stateChangeAnimation = ConstantValues.defaultAnimation
stateChangeAnimation = DefaultValues.animation
}
}
}
Expand All @@ -38,7 +38,7 @@ public extension M13Checkbox {
if let type = MarkType(rawValue: newValue) {
markType = type
} else {
markType = ConstantValues.defaultMarkType
markType = DefaultValues.markType
}
}
}
Expand All @@ -52,7 +52,7 @@ public extension M13Checkbox {
if let type = BoxType(rawValue: newValue) {
boxType = type
} else {
boxType = ConstantValues.defaultBoxType
boxType = DefaultValues.boxType
}
}
}
Expand All @@ -66,7 +66,7 @@ public extension M13Checkbox {
if let temp = CheckState(rawValue: newValue) {
checkState = temp
} else {
checkState = ConstantValues.defaultCheckState
checkState = DefaultValues.checkState
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/M13Checkbox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ open class M13Checkbox: UIControl {

/// The manager that manages display and animations of the checkbox.
/// The default animation is a stroke.
fileprivate var controller: M13CheckboxController = ConstantValues.defaultController
fileprivate var controller: M13CheckboxController = DefaultValues.controller

//----------------------------
// MARK: - Initalization
Expand All @@ -238,7 +238,7 @@ open class M13Checkbox: UIControl {
layer.addSublayer(aLayer)
}
controller.tintColor = tintColor
controller.resetLayersForState(ConstantValues.defaultCheckState)
controller.resetLayersForState(DefaultValues.checkState)

let longPressGesture = M13CheckboxGestureRecognizer(target: self, action: #selector(M13Checkbox.handleLongPress(_:)))
addGestureRecognizer(longPressGesture)
Expand Down Expand Up @@ -345,7 +345,7 @@ open class M13Checkbox: UIControl {
}

/// The type of animation to preform when changing from the unchecked state to any other state.
open var stateChangeAnimation: Animation = ConstantValues.defaultAnimation {
open var stateChangeAnimation: Animation = DefaultValues.animation {
didSet {

// Remove the sublayers
Expand Down
4 changes: 2 additions & 2 deletions Sources/M13CheckboxController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal class M13CheckboxController {
var animationGenerator: M13CheckboxAnimationGenerator = M13CheckboxAnimationGenerator()

/// The current state of the checkbox.
var state: M13Checkbox.CheckState = .unchecked
var state: M13Checkbox.CheckState = DefaultValues.checkState

/// The current tint color.
/// - Note: Subclasses should override didSet to update the layers when this value changes.
Expand All @@ -48,7 +48,7 @@ internal class M13CheckboxController {
var enableMorphing: Bool = true

// The type of mark to display.
var markType: M13Checkbox.MarkType = .checkmark {
var markType: M13Checkbox.MarkType = DefaultValues.markType {
willSet {
if markType == newValue {
return
Expand Down
2 changes: 1 addition & 1 deletion Sources/Paths/M13CheckboxPathGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal class M13CheckboxPathGenerator {
var cornerRadius: CGFloat = 3.0

/// The box type to create.
var boxType: M13Checkbox.BoxType = .circle
var boxType: M13Checkbox.BoxType = DefaultValues.boxType

//----------------------------
// MARK: - Box Paths
Expand Down

0 comments on commit 65be638

Please sign in to comment.