Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
abdullah-original committed Apr 2, 2024
1 parent 957274b commit 107675c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

`DatePicker` from SwiftUI only has two modes (`date`, and `hourAndMinute`) which for many cases is not sufficient. Often you need to switch between even more modes. ExtendedDatePicker solves this problem by providing extra modes that SwiftUI doesn't provide out of the box.

| Time | Date | DateTime | MonthYear| Year|
| - | - | - | - | - |
| ![time](./images/time.png) | ![date](./images/date.png) | ![dateTime](./images/dateTime.png) | ![monthYear](./images/monthYear.png) | ![year](./images/year.png)
| Time | Date | DateTime | Week | MonthYear| Year|
| - | - | - | - | - | - |
| ![time](./images/time.png) | ![date](./images/date.png) | ![dateTime](./images/dateTime.png) | ![week](./images/week.png) | ![monthYear](./images/monthYear.png) | ![year](./images/year.png)

## Installation
`ExtendedDatePicker` is available to be installed in your app via [Swift Package Manager](https://www.swift.org/documentation/package-manager/) using the git url `https://github.com/abdullah-original/ExtendedDatePicker.git`.
Expand All @@ -28,7 +28,7 @@ Initialize the date picker as above. If you want to provide a custom locale or t
In addition, some UI elements (such as back and forward arrows) can be customized using `options: ExtendedDatePickerOptions` parameter.


The client must provide at least `selectedDate`, `dateRange`, `mode` parameters. `selectedDate` is the state object that keeps track of currently selected date by user. In modes such as `monthYear` and `year`, the user is only shown the appropriate components, but `selectedDate` keeps track of a possible date for the selected year, or month and year e.g. if user has selected year 2024, `selectedDate` would be `x-y-2024` (no guarantees are made for x, and y). Client should just extract the relevant component based on the provided mode e.g. `calendar.component(.year, from: selectedDate)`.
The client must provide at least `selectedDate`, `dateRange`, `mode` parameters. `selectedDate` is the state object that keeps track of currently selected date by user. In modes such as `monthYear` and `year`, the UI displays only appropriate components to the user, but `selectedDate` keeps track of a possible date for the selected year, or monthYear e.g. if user has selected year 2024, `selectedDate` would be `x-y-2024` (no guarantees are made for x, and y). Client should just extract the relevant component based on the provided mode e.g. `calendar.component(.year, from: selectedDate)`.

## Feedback
If you have any feedback or improvements to suggest, please free to open an issue.
2 changes: 1 addition & 1 deletion Sources/DateMode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public enum DateMode {
case date
/// Date, hour and minute.
case dateTime
/// Week
/// Week of year
case week
/// Month and year.
case monthYear
Expand Down
Binary file added images/week.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 107675c

Please sign in to comment.