|
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | +<p><h1 align="left">FXDatePicker</h1></p> |
| 5 | + |
| 6 | +<p><h4>A SwiftUI library for a customizable DatePicker.</h4></p> |
| 7 | + |
| 8 | +# Features |
| 9 | +* Supports both Hijri and Gregorian calendars. |
| 10 | +* Allows adding images below days using Image or SF Symbols. |
| 11 | +* Supports Arabic and English languages. |
| 12 | +* Compatible with Dark and Light Modes. |
| 13 | +* Offers full customization. |
| 14 | + |
| 15 | +# FXDatePicker vs. iOS DatePicker |
| 16 | + |
| 17 | +* **Customization**: FXDatePicker allows for extensive customization, including the ability to add icons below dates. In contrast, the iOS DatePicker offers basic functionality with limited customization options. |
| 18 | +* **User Interface**: FXDatePicker features a modern, adaptable interface for a tailored user experience, while the iOS DatePicker maintains a standard, unchangeable appearance. |
| 19 | +* **Flexibility**: FXDatePicker is ideal for creating distinctive, engaging date-picking experiences. The iOS DatePicker is more suited for applications that require basic date selection. |
| 20 | + |
| 21 | +# Usage |
| 22 | +1. Add a binding `Date` variable to save the selection. |
| 23 | +2. Create a `specialDates` array to add images below dates. |
| 24 | +3. Initialize FXDatePicker and present it as desired. |
| 25 | + |
| 26 | +```swift |
| 27 | +FXDatePickerView(selectedDate: $selectedDate, specialDates: specialDates) |
| 28 | +``` |
| 29 | + |
| 30 | +# Customize | Available modifiers: |
| 31 | + |
| 32 | +### calenderType |
| 33 | + |
| 34 | +Change the DatePicker type using calendarType. For example, to use the Hijri calendar: |
| 35 | + |
| 36 | +```swift |
| 37 | +FXDatePickerView(selectedDate: $selectedDate, specialDates: specialDates) |
| 38 | +.calenderType(.hijri) |
| 39 | +``` |
| 40 | + |
| 41 | +The default is `.gregorian.` |
| 42 | + |
| 43 | +### datePickerTheme |
| 44 | + |
| 45 | +Customize the theme of the DatePicker using datePickerTheme. For example: |
| 46 | + |
| 47 | +```swift |
| 48 | +FXDatePickerView(selectedDate: $selectedDate, specialDates: specialDates) |
| 49 | +.datePickerTheme(main: |
| 50 | + .init( |
| 51 | +accentColor: Color(uiColor: UIColor(red: 0.23, green: 0.80, blue: 0.81, alpha: 1.00)), |
| 52 | +monthTitle: .white, |
| 53 | +daysName: Color(uiColor: UIColor(red: 0.45, green: 0.48, blue: 0.48, alpha: 1.00)), |
| 54 | +daysNumbers: Color(uiColor: UIColor(red: 0.83, green: 0.84, blue: 0.84, alpha: 1.00)), |
| 55 | +previousDaysNumber: Color(uiColor: UIColor(red: 0.44, green: 0.47, blue: 0.47, alpha: 1.00)), |
| 56 | +backgroundColor: Color(uiColor: UIColor(red: 0.22, green: 0.25, blue: 0.25, alpha: 1.00))) |
| 57 | + ) |
| 58 | +``` |
| 59 | +The default theme has a white background with a blue accent color. |
| 60 | + |
| 61 | + |
0 commit comments