All Projects → calda → WatchKitTimePicker

calda / WatchKitTimePicker

Licence: MIT License
⏱ A Time Picker data source for WatchKit that mirrors the behavior of UIDatePicker.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to WatchKitTimePicker

Brpickerview
BRPickerView 封装的是iOS中常用的选择器组件,主要包括:日期选择器(支持年月日、年月等15种日期样式选择,支持设置星期、至今等)、地址选择器(支持省市区、省市、省三种地区选择)、自定义字符串选择器(支持单列、多列、二级联动、三级联动选择)。支持自定义主题样式,适配深色模式,支持将选择器组件添加到指定容器视图。
Stars: ✭ 2,149 (+5708.11%)
Mutual labels:  time, picker, uidatepicker
Date Picker
📅 Custom responsive date picker widget for Android, written in Kotlin.
Stars: ✭ 146 (+294.59%)
Mutual labels:  time, picker
Pickadate.js
The mobile-friendly, responsive, and lightweight jQuery date & time input picker.
Stars: ✭ 7,753 (+20854.05%)
Mutual labels:  time, picker
ngx-mat-timepicker
A true material timepicker
Stars: ✭ 45 (+21.62%)
Mutual labels:  time, picker
Vue Ctk Date Time Picker
VueJS component to select dates & time, including a range mode
Stars: ✭ 707 (+1810.81%)
Mutual labels:  time, picker
Singledateandtimepicker
You can now select a date and a time with only one widget !
Stars: ✭ 921 (+2389.19%)
Mutual labels:  time, picker
React Native Modal Datetime Picker
A React-Native datetime-picker for Android and iOS
Stars: ✭ 2,412 (+6418.92%)
Mutual labels:  time, picker
Md Date Time Picker
An implementation of Material Design Picker components in vanilla CSS, JS, and HTML
Stars: ✭ 272 (+635.14%)
Mutual labels:  time, picker
SmogWatch
watchOS app for checking air pollution levels, created for my blog post series
Stars: ✭ 34 (-8.11%)
Mutual labels:  watchos, watchkit
popoPicker
popoPicker是一个移动端3D滚轮日期时间和单项的选择器,支持无限循环滚动,不依赖第三方库
Stars: ✭ 26 (-29.73%)
Mutual labels:  time, picker
HijriDatePicker
Material (Gregorian - Hijri) Date & Time Picker
Stars: ✭ 128 (+245.95%)
Mutual labels:  time, picker
React Timekeeper
Google Keep app inspired time picker for react 🕓
Stars: ✭ 651 (+1659.46%)
Mutual labels:  time, picker
Linear Time Picker
Gorgeous Android Time and Date picker library inspired by the Timely app
Stars: ✭ 613 (+1556.76%)
Mutual labels:  time, picker
React Picky Date Time
A react component for date time picker. Online demo examples
Stars: ✭ 31 (-16.22%)
Mutual labels:  time, picker
Angular Moment Picker
Angular Moment Picker is an AngularJS directive for date and time picker using Moment.js.
Stars: ✭ 536 (+1348.65%)
Mutual labels:  time, picker
vue-timeselector
🕒 Simply customizable powerful time picker for Vue.js
Stars: ✭ 41 (+10.81%)
Mutual labels:  time, picker
Ios Samples
Xamarin.iOS sample apps
Stars: ✭ 1,501 (+3956.76%)
Mutual labels:  watchos, watchkit
clocklet
An opinionated clock-style vanilla-js timepicker.
Stars: ✭ 31 (-16.22%)
Mutual labels:  time, picker
react-picky-date-time
A react component for date time picker. Online demo examples
Stars: ✭ 41 (+10.81%)
Mutual labels:  time, picker
WatchActivityIndicator
An Apple Watch activity indicator
Stars: ✭ 23 (-37.84%)
Mutual labels:  watchos, watchkit

WatchKitTimePicker

WatchKitTimePicker is a time picker data source for WatchKit that...

  • Mirrors the behavior of UIKit's UIDatePicker
  • Automatically uses either 12-hour or 24-hour time, depending on the user's current Locale.
  • Supports watchOS 2.0+

Demo


Installation

Manual Installation:

WatchKitTimePicker is just one individual .swift file: TimePickerDataSource.swift. You could install it quickly by downloading that file and dragging it in to your Watch App Extension target.

Carthage:

Add github "calda/WatchKitTimePicker" to your Cartfile.

Usage

Unlike with iOS view-layer libraries, you can't just distribute and use a UIView or WKInterfaceObject subclass. Interface elements have to be set up using Interface Builder.

WatchKitTimePicker is a data source that controls and manages a group of WKInterfacePicker objects.

Interface Builder:

  • Create a horizontal WKInterfaceGroup.
  • Add three WKInterfacePicker objects to the group.
  • Connect and @IBOutlet and an @IBAction for each of the pickers.

Your WKInterfaceController subclass:

import WatchKit
import Foundation
import WatchKitTimePicker

class InterfaceController: WKInterfaceController {

    var timePickerDataSource: TimePickerDataSource!
    @IBOutlet weak var hourTimePicker: WKInterfacePicker!
    @IBOutlet weak var minuteTimePicker: WKInterfacePicker!
    @IBOutlet weak var amPmTimePicker: WKInterfacePicker!
    
    override func awake(withContext context: Any?) {
        timePickerDataSource = TimePickerDataSource(
            hoursPicker: hourTimePicker,
            minutesPicker: minuteTimePicker,
            amPmPicker: amPmTimePicker,
            interval: .fiveMinutes) // supports .minute, .fiveMinutes, .fifteenMinutes, and .halfHour
        
        timePickerDataSource.selectedTimeDidUpdate = { selectedTime in
            // ...
        }
        
        timePickerDataSource.updateDate(to: Date())
    }
    
    @IBAction func hourPickerDidUpdate(_ index: Int) {
        timePickerDataSource.hourPickerUpdated(to: index)
    }
    
    @IBAction func minutePickerDidUpdate(_ index: Int) {
        timePickerDataSource.minutePickerUpdated(to: index)
    }
    
    @IBAction func amPmPickerDidUpdate(_ index: Int) {
        timePickerDataSource.amPmPickerUpdated(to: index)
    }
    
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].