{"id":13838507,"url":"https://github.com/calda/WatchKitTimePicker","last_synced_at":"2025-07-10T23:31:27.648Z","repository":{"id":40139202,"uuid":"156258005","full_name":"calda/WatchKitTimePicker","owner":"calda","description":"⏱ A Time Picker data source for WatchKit that mirrors the behavior of UIDatePicker.","archived":false,"fork":false,"pushed_at":"2019-10-22T23:17:45.000Z","size":1019,"stargazers_count":40,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-04T01:32:03.929Z","etag":null,"topics":["picker","swift","time","uidatepicker","watchkit","watchos"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/calda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-05T17:40:50.000Z","updated_at":"2024-08-01T02:36:50.000Z","dependencies_parsed_at":"2022-07-28T12:19:11.742Z","dependency_job_id":null,"html_url":"https://github.com/calda/WatchKitTimePicker","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/calda/WatchKitTimePicker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calda%2FWatchKitTimePicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calda%2FWatchKitTimePicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calda%2FWatchKitTimePicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calda%2FWatchKitTimePicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/calda","download_url":"https://codeload.github.com/calda/WatchKitTimePicker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calda%2FWatchKitTimePicker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264687866,"owners_count":23649576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["picker","swift","time","uidatepicker","watchkit","watchos"],"created_at":"2024-08-04T16:00:19.815Z","updated_at":"2025-07-10T23:31:27.128Z","avatar_url":"https://github.com/calda.png","language":"Swift","funding_links":[],"categories":["Library"],"sub_categories":["Utility"],"readme":"# WatchKitTimePicker\n\n**WatchKitTimePicker** is a time picker data source for WatchKit that...\n - Mirrors the behavior of UIKit's `UIDatePicker`\n - Automatically uses either 12-hour or 24-hour time, depending on the user's current Locale.\n - Supports watchOS 2.0+\n \n## Demo\n \n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"images/watchkit time picker 12hr.gif\" width=\"300px\"\u003e  \u003cimg src=\"images/watchkit time picker 24hr.gif\" width=\"300px\"\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n\n## Installation\n\n#### Manual Installation:\n\n**WatchKitTimePicker** is just one individual .swift file: [`TimePickerDataSource.swift`](https://github.com/calda/WatchKitTimePicker/blob/master/WatchKitTimePicker/TimePickerDataSource.swift). You could install it quickly by downloading that file and dragging it in to your Watch App Extension target.\n\n#### [Carthage](https://github.com/Carthage/Carthage):\n\nAdd `github \"calda/WatchKitTimePicker\"` to your Cartfile.\n\n## Usage\n\nUnlike 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.\n\n**WatchKitTimePicker** is a data source that controls and manages a group of `WKInterfacePicker` objects. \n\n### Interface Builder:\n\n- Create a horizontal `WKInterfaceGroup`.\n- Add three `WKInterfacePicker` objects to the group.\n- Connect and `@IBOutlet` and an `@IBAction` for each of the pickers.\n\n### Your `WKInterfaceController` subclass:\n\n```Swift\nimport WatchKit\nimport Foundation\nimport WatchKitTimePicker\n\nclass InterfaceController: WKInterfaceController {\n\n    var timePickerDataSource: TimePickerDataSource!\n    @IBOutlet weak var hourTimePicker: WKInterfacePicker!\n    @IBOutlet weak var minuteTimePicker: WKInterfacePicker!\n    @IBOutlet weak var amPmTimePicker: WKInterfacePicker!\n    \n    override func awake(withContext context: Any?) {\n        timePickerDataSource = TimePickerDataSource(\n            hoursPicker: hourTimePicker,\n            minutesPicker: minuteTimePicker,\n            amPmPicker: amPmTimePicker,\n            interval: .fiveMinutes) // supports .minute, .fiveMinutes, .fifteenMinutes, and .halfHour\n        \n        timePickerDataSource.selectedTimeDidUpdate = { selectedTime in\n            // ...\n        }\n        \n        timePickerDataSource.updateDate(to: Date())\n    }\n    \n    @IBAction func hourPickerDidUpdate(_ index: Int) {\n        timePickerDataSource.hourPickerUpdated(to: index)\n    }\n    \n    @IBAction func minutePickerDidUpdate(_ index: Int) {\n        timePickerDataSource.minutePickerUpdated(to: index)\n    }\n    \n    @IBAction func amPmPickerDidUpdate(_ index: Int) {\n        timePickerDataSource.amPmPickerUpdated(to: index)\n    }\n    \n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalda%2FWatchKitTimePicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcalda%2FWatchKitTimePicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalda%2FWatchKitTimePicker/lists"}