Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gligorkot/TimeZonePicker
A TimeZonePicker UIViewController similar to the iOS Settings app. Search and select from a range of cities and countries to find your most suitable time zone.
https://github.com/gligorkot/TimeZonePicker
swift swift-3 swift3 timezone timezone-library timezone-list timezone-picker timezones
Last synced: 3 months ago
JSON representation
A TimeZonePicker UIViewController similar to the iOS Settings app. Search and select from a range of cities and countries to find your most suitable time zone.
- Host: GitHub
- URL: https://github.com/gligorkot/TimeZonePicker
- Owner: gligorkot
- License: apache-2.0
- Created: 2017-07-18T20:33:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-08-05T22:04:31.000Z (about 4 years ago)
- Last Synced: 2024-07-31T17:26:42.824Z (3 months ago)
- Topics: swift, swift-3, swift3, timezone, timezone-library, timezone-list, timezone-picker, timezones
- Language: Swift
- Homepage:
- Size: 492 KB
- Stars: 125
- Watchers: 3
- Forks: 17
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-ios - TimeZonePicker - A TimeZonePicker UIViewController similar to the iOS Settings app. (Date & Time / Getting Started)
- awesome-ios-star - TimeZonePicker - A TimeZonePicker UIViewController similar to the iOS Settings app. (Date & Time / Getting Started)
- fucking-awesome-ios - TimeZonePicker - A TimeZonePicker UIViewController similar to the iOS Settings app. (Date & Time / Getting Started)
- fucking-awesome-ios - TimeZonePicker - A TimeZonePicker UIViewController similar to the iOS Settings app. (Date & Time / Getting Started)
README
# TimeZonePicker
[![Build Status](https://app.bitrise.io/app/a8aacfeca49db0dd/status.svg?token=SyGPKzROHbYxep4c9-9czA)](https://app.bitrise.io/app/a8aacfeca49db0dd)
[![codebeat badge](https://codebeat.co/badges/dac53a60-fe1f-4b5f-9098-99b17d720977)](https://codebeat.co/projects/github-com-gligorkot-timezonepicker-master)
[![Version](https://img.shields.io/cocoapods/v/TimeZonePicker.svg)](http://cocoadocs.org/docsets/TimeZonePicker)
[![License](https://img.shields.io/cocoapods/l/TimeZonePicker.svg)](http://cocoadocs.org/docsets/TimeZonePicker)
[![Platform](https://img.shields.io/cocoapods/p/TimeZonePicker.svg)](http://cocoadocs.org/docsets/TimeZonePicker)A TimeZonePicker UIViewController similar to the iOS Settings app. Search and select from a range of cities and countries to find your most suitable time zone.
## Screenshots
![](Screenshots/Screenshot.png)
![](Screenshots/Preview.gif)## Installation
### CocoaPods
To install it in your iOS project, install with [CocoaPods](http://cocoapods.org)
```ruby
pod 'TimeZonePicker'
```## Usage
### Basic Initialisation
To initialise a `timeZonePicker` you can use the class function `getVC(withDelegate: TimeZonePickerDelegate)` on the `TimeZonePickerViewController` as below:
```swift
let timeZonePicker = TimeZonePickerViewController.getVC(withDelegate: self)
```Then you can use the `timeZonePicker` as you would any `UIViewController`, for example:
```swift
present(timeZonePicker, animated: true, completion: nil)
```### TimeZonePickerDelegate
The `TimeZonePickerDelegate` currently has only one method that needs to be implemented:
```swift
func timeZonePicker(_ timeZonePicker: TimeZonePickerViewController, didSelectTimeZone timeZone: TimeZone)
```Once an item is selected from the table of cities/countries the above delegate method gets called, conveniently returning the `TimeZonePickerViewController` and the selected `TimeZone`. You can use the `timeZonePicker` to dismiss it here and the `timeZone` as you need it in your application. For example:
```swift
func timeZonePicker(_ timeZonePicker: TimeZonePickerViewController, didSelectTimeZone timeZone: TimeZone) {
timeZoneName.text = timeZone.identifier
timeZoneOffset.text = timeZone.abbreviation()
timeZonePicker.dismiss(animated: true, completion: nil)
}
```Please check the `TimeZonePickerExample` project for the above usage example. If you have any questions do not hesitate to get in touch with me.
## Requirements
* iOS 8 or later.
* Swift 3## License
Copyright (c) 2017 Gligor KotushevskiLicensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.