Latest 0.2.2
Homepage https://github.com/jcmendez/JCMTimeSlider
License MIT
Platforms ios , requires ARC
Authors

This is an iOS control to navigate a timeline with large number of data points (dates). Well documented

JCMTimeSlider in action

Usage

The code below gives an idea of what it is needed to use the control. The regular datasource/delegate pattern is used.

The data source needs to implement 2 functions: numberOfDates() and dateAtIndex(). The latter must guarantee the dates are sorted in ascending order.

class SampleData: JCMTimeSliderControlDataSource {
  func numberOfDates() -> Int {
    return data!.count
  }

  func dateAtIndex(index: Int) -> NSDate {
    return data![index]
  }
}

The delegate can optionally implement hoveredOverDate and selectedDate

class ViewController: UIViewController, JCMTimeSliderControlDelegate {

  @IBOutlet var timeControl1: JCMTimeSliderControl?

  override func viewDidLoad() {
    super.viewDidLoad()
    timeControl1?.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.4)
    timeControl1?.dataSource = your_data_source
    timeControl1?.delegate = self
    timeControl1?.tag = 1
  }

  func hoveredOverDate(date: NSDate, index: Int, control: JCMTimeSliderControl) {
    println("Hovered over control: (control.tag) -> Date: (date), loc: (index)")
  }

  func selectedDate(date: NSDate, index: Int, control: JCMTimeSliderControl) {
    println("Selected control: (control.tag) -> Date: (date), loc: (index)")
  }

}

To Do

Lots of debugging required. This is a very early implementation.

Latest podspec

{
    "name": "JCMTimeSlider",
    "version": "0.2.2",
    "summary": "iOS control to navigate a timeline with large number of data points (dates).",
    "description": "                   This is an iOS control to navigate a timeline with large number of data points, written in Swiftnn                   * Works with few or a large number of data points.n                   * Uses non-linear selection around your touch, for easy selection.n                   * Similar look and feel to the Time Machine controln",
    "homepage": "https://github.com/jcmendez/JCMTimeSlider",
    "screenshots": "http://jcmendez.github.io/JCMTimeSlider/images/sample.gif",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Juan C. Mendez": "[email protected]"
    },
    "social_media_url": "http://twitter.com/jcmendez_us",
    "platforms": {
        "ios": null
    },
    "source": {
        "git": "https://github.com/jcmendez/JCMTimeSlider.git",
        "tag": "0.2.2"
    },
    "source_files": "TimeSlider/JCMTimeSliderControl.swift",
    "requires_arc": true
}

Pin It on Pinterest

Share This