-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Beau
committed
May 6, 2017
1 parent
73f0734
commit 3b46f7a
Showing
5 changed files
with
54 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ xcuserdata/ | |
## Other | ||
*.moved-aside | ||
*.xcuserstate | ||
*.DS_Store | ||
|
||
## Obj-C/Swift specific | ||
*.hmap | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,53 @@ | ||
# DateTextField | ||
This projects goal is to do for dates what [PhoneNumberKit](https://github.com/marmelroy/PhoneNumberKit) has done for phone numbers. | ||
|
||
> **NOTE:** Looking to the Swift community for help to improve this project as it is still in development. | ||
|
||
The current date picker isn't appropriate in all cases. | ||
|
||
It's limited in customisability, replaces the keyboard, and can be slower than simply typing in a date. | ||
|
||
Sometimes you may only want to capture the day and month, or the month and year, such as with credit card expiry dates. | ||
|
||
![uidatepickerexample](images/uidatepickerexample.png) | ||
|
||
|
||
## DateTextField | ||
|
||
|
||
DateTextField aims to not replace UIDatePicker but to provide an alternative where UIDatePicker may not be the best tool for the job. | ||
|
||
![demo](images/demo.gif) | ||
|
||
## Installation | ||
|
||
> This project doesn't currently support Cocoapods or Carthage. | ||
Simply drag the DateTextField.swift file into your project. | ||
|
||
## Usage | ||
|
||
After initialising there's only two properties you really need to take care of. | ||
|
||
myDateTextField.dateFormat = .monthYear | ||
myDateTextField.separator = "-" | ||
|
||
|
||
|
||
#### `dateFormat` | ||
Currenty supports `.monthYear`, `.dayMonthYear`, and `.monthDayYear` formats. Would love to support custom formats. | ||
|
||
#### `separator` | ||
|
||
Determines what separator you would like to use between date elements. Most common used are dashes `-`, and slashes `/`. | ||
|
||
#### `date` | ||
|
||
**set:** Sets the `text` property of `DateTextField` to the supplied date. Formatted as determined by `separator` and `dateFormat`. | ||
|
||
**get:** Parses and returns the `text` property as a `Date`. Returns `nil` if text could not be parsed. | ||
|
||
|
||
Be sure to have a look at the demo project to see it in use. | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.