Latest 0.0.9
Homepage https://github.com/MaikoHermans/MHInteractiveClock
License MIT
Platforms ios 9.0, requires ARC
Frameworks UIKit
Authors

MHInteractiveClock

MHInteractiveClock is a pod that will allow you to draw a clock which can be interacted with in your app.

You will no longer have to figure out all the required formulas to draw the clock handles and use the input of a user.
MHInteractiveClock is easy stylable to your likings.

Installation

Installation with CocoaPods

MHInteractiveClock: MHInteractiveClock is available through CocoaPods, to install
it simply add the following line to your Podfile:

pod 'MHInteractiveKeyboard'

Usage

Firstly import MHInteractiveClock in the class you would like to draw out the clock.

import MHInteractiveClock 

Initialization

You can now use the Clock by either using storyboard or code.

StoryBoard:

alt text

Code:

All you have to do is specify the frame (or use constraints if you prefer) like below

let clock = ClockView(frame: CGRect(x: 0, y: 0, width: 375, height: 375))

view.addSubview(clock)

Style

You are able to change multiple things regarding the styling of the clock.

  • clockFaceBorderWidth
  • clockFaceBorderColor
  • clockCenterSize
  • clockCenterColor
  • clockHandWidth
  • clockHandColor
  • clockHandHeightMultiplier
  • numberFont
  • numberColor
  • numberRadius
  • selectedCircleColor
  • selectedCircleSize
  • selectedCircleFont
  • selectedCircleTextColor
  • hourTickMultiplier
  • minuteTickMultiplier
  • hourTickColor
  • minuteTickColor
  • selectedHourTickMultiplier
  • selectedMinuteTickMultiplier
  • selectedHourTickColor
  • selectedMinuteTickColor
  • selectedHourTickWidth
  • selectedMinuteTickWidth

Control

You are also able to manipulte certain characteristics of the clock.

  • delegate
  • autoSwitch
  • switchDelay
  • isHours
  • displayNumbers
  • displayTicks
  • displaySelectedTick
  • displaySelectedHourTick

Delegate Functions

The clock has a few delegate functions which tell you which time is currently selected by the user.

Selected Hours

This function will be called when the user interacted with the handle when the hour state was active. It will pass you the hour that’s currently selected by the user.

func didSelectHours(hours: CGFloat)

Selected Minutes

This function will be called when the user interacted with the handle when the minute state was active. It will pass you the minute that’s currently selected by the user.

func didSelectMinutes(minutes: CGFloat)

Latest podspec

{
    "name": "MHInteractiveClock",
    "platforms": {
        "ios": "9.0"
    },
    "version": "0.0.9",
    "summary": "A customizable clock of which the handle can be interacted with.",
    "requires_arc": true,
    "swift_version": "4.0",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Maiko Hermans": "[email protected]"
    },
    "homepage": "https://github.com/MaikoHermans/MHInteractiveClock",
    "source": {
        "git": "https://github.com/MaikoHermans/MHInteractiveClock.git",
        "tag": "0.0.9"
    },
    "frameworks": "UIKit",
    "source_files": "MHInteractiveClock/**/*.{swift}"
}

Pin It on Pinterest

Share This