https://github.com/kautenja/uipopupdatepicker
a simple PopupDialog for selecting a datetime
https://github.com/kautenja/uipopupdatepicker
carthage date-picker datetime-picker ios ios-framework popup-dialog ui-components
Last synced: 6 months ago
JSON representation
a simple PopupDialog for selecting a datetime
- Host: GitHub
- URL: https://github.com/kautenja/uipopupdatepicker
- Owner: Kautenja
- License: mit
- Created: 2017-07-18T08:26:58.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-18T00:34:11.000Z (about 8 years ago)
- Last Synced: 2025-02-14T10:18:37.735Z (8 months ago)
- Topics: carthage, date-picker, datetime-picker, ios, ios-framework, popup-dialog, ui-components
- Language: Swift
- Homepage:
- Size: 58.5 MB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# UIPopupDatePicker
[![swift-badge][]][swift-link]
[![carthage-badge][]][carthage-link][swift-badge]: https://img.shields.io/badge/swift-4.0-orange.svg
[swift-link]: https://swift.org/
[carthage-badge]: https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat
[carthage-link]: https://github.com/Carthage/Carthage## Screenshots
### With Time Picker
### Without Time Picker
## Requirements
This framework relies on (and installs):
* [PopupDialog](https://github.com/Orderella/PopupDialog)
* [FSCalendar](https://github.com/WenchaoD/FSCalendar)## Installation
### Carthage
Add the following to your Cartfile
```ruby
github "kautenja/UIPopupDatePicker" ~> 1.1
```## Example
To run the example project, clone the repo, and build it on devices of you choosing.
### Code Usage
#### Creation
The main entry point for UIPopupDatePicker is the static `show` method.
```swift
_ = UIPopupDatePicker.show(on: self, with: nil, block: nil)
```#### Customization
This function returns an instance of UIPopupDatePicker in case you might want to
manipulate some of the controller manually:```swift
let popup = UIPopupDatePicker.show(on: self, with: nil, block: nil)
popup.headerText = "Some text you might want as a title!"
```#### Callback
To respond to a change in the date use the callback handler:
```swift
_ = UIPopupDatePicker.show(on: self, with: Date()) { (selected) in
NSLog("UIPopupDatePicker returned \(selected) in the callback")
}
```the parameter passed to the anonymous function an optional date (`Date?`). If the user:
1. presses done
the callback will be executed with the date from the calendar and time from the picker. If
the time picker is hidden, the time will be the time that the popup was first created.2. presses clear
the callback will be executed passing `nil` as the parameter to the anonymous function.
Use this to remove a date from something.3. presses cancel
the callback **IS NOT** executed and the popup dismisses with no changes to the parent
view controller.### Code Samples
see [ViewController](PopupDatePicker/ViewController.swift) for a production example of how this might come together
## Author
Kautenja, kautencreations@gmail.com
## License
**TL;DR** do what you want with it.
UIPopupDatePicker is available under the MIT license. See the [LICENSE](./LICSENSE) file
for more info.