- Supports both Hijri and Gregorian calendars.
- Allows adding images below days using Image or SF Symbols.
- Supports Arabic and English languages.
- Compatible with Dark and Light Modes.
- Offers full customization.
- 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.
- User Interface: FXDatePicker features a modern, adaptable interface for a tailored user experience, while the iOS DatePicker maintains a standard, unchangeable appearance.
- Flexibility: FXDatePicker is ideal for creating distinctive, engaging date-picking experiences. The iOS DatePicker is more suited for applications that require basic date selection.
- Add a binding
Date
variable to save the selection. - Create a
specialDates
array to add images below dates. - Initialize FXDatePicker and present it as desired.
FXDatePickerView(selectedDate: $selectedDate, specialDates: specialDates)
Change the DatePicker type using calendarType. For example, to use the Hijri calendar:
FXDatePickerView(selectedDate: $selectedDate, specialDates: specialDates)
.calenderType(.hijri)
The default is .gregorian.
Customize the theme of the DatePicker using datePickerTheme. For example:
FXDatePickerView(selectedDate: $selectedDate, specialDates: specialDates)
.datePickerTheme(main:
.init(
accentColor: Color(uiColor: UIColor(red: 0.23, green: 0.80, blue: 0.81, alpha: 1.00)),
monthTitle: .white,
daysName: Color(uiColor: UIColor(red: 0.45, green: 0.48, blue: 0.48, alpha: 1.00)),
daysNumbers: Color(uiColor: UIColor(red: 0.83, green: 0.84, blue: 0.84, alpha: 1.00)),
previousDaysNumber: Color(uiColor: UIColor(red: 0.44, green: 0.47, blue: 0.47, alpha: 1.00)),
backgroundColor: Color(uiColor: UIColor(red: 0.22, green: 0.25, blue: 0.25, alpha: 1.00)))
)
The default theme has a white background with a blue accent color.