Skip to content

Commit

Permalink
Added all options to demo playground.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marxon13 committed Sep 30, 2016
1 parent 43ff6c6 commit 5fb7628
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
Binary file not shown.
53 changes: 51 additions & 2 deletions M13Checkbox Demo Playground/Playground.playground/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,61 @@
import M13Checkbox
import PlaygroundSupport

//: Creating A Checkbox
//: -------------------

let checkbox = M13Checkbox(frame: CGRect(x: 0.0, y: 0.0, width: 250.0, height: 250.0))

//: Managing States
//: ---------------

// Update the state of the checkbox programatically, with or without animation.
checkbox.setCheckState(.checked, animated: false)
checkbox.setCheckState(.unchecked, animated: false)

// Or toggle the state
checkbox.toggleCheckState(false)

// Set values to the checkbox to return depending on its state.
checkbox.checkedValue = 1.0
checkbox.uncheckedValue = 0.0
checkbox.mixedValue = 0.5

print("Checkbox Value: \(checkbox.value)")

//: Animations
//: ----------

// Update the animation duration
checkbox.animationDuration = 1.0

// Change the animation used when switching between states.
checkbox.stateChangeAnimation = .bounce(.fill)

//: Appearance
//: ----------

// The background color of the veiw.
checkbox.backgroundColor = .white
// The tint color when in the selected state.
checkbox.tintColor = .yellow
// The tint color when in the unselected state.
checkbox.secondaryTintColor = .green
// The color of the checkmark when the animation is a "fill" style animation.
checkbox.secondaryCheckmarkTintColor = .red

// Whether or not to display a checkmark, or radio mark.
checkbox.markType = .checkmark
// The line width of the checkmark.
checkbox.checkmarkLineWidth = 2.0
checkbox.stateChangeAnimation = .bounce(.fill)

PlaygroundPage.current.liveView = checkbox
// The line width of the box.
checkbox.boxLineWidth = 2.0
// The corner radius of the box if it is a square.
checkbox.cornerRadius = 4.0
// Whether the box is a square, or circle.
checkbox.boxType = .circle
// Whether or not to hide the box.
checkbox.hideBox = false

PlaygroundPage.current.liveView = checkbox
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios'>
<playground version='5.0' target-platform='ios' display-mode='raw'>
<timeline fileName='timeline.xctimeline'/>
</playground>

0 comments on commit 5fb7628

Please sign in to comment.