Skip to content

Commit

Permalink
Updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Beau committed May 6, 2017
1 parent 73f0734 commit 3b46f7a
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ xcuserdata/
## Other
*.moved-aside
*.xcuserstate
*.DS_Store

## Obj-C/Swift specific
*.hmap
Expand Down
8 changes: 0 additions & 8 deletions DateTextField.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,11 @@
A1B754FD1EBDAFEE00472852 /* LaunchScreen.storyboard */,
A1B754FF1EBDAFEE00472852 /* Main.storyboard */,
A1B755011EBDAFEE00472852 /* Info.plist */,
A1B755021EBDAFEE00472852 /* untitled folder */,
A1B755031EBDAFEE00472852 /* ViewController.swift */,
);
path = Demo;
sourceTree = SOURCE_ROOT;
};
A1B755021EBDAFEE00472852 /* untitled folder */ = {
isa = PBXGroup;
children = (
);
path = "untitled folder";
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down
54 changes: 53 additions & 1 deletion README.md
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.


Binary file added images/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/uidatepickerexample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3b46f7a

Please sign in to comment.