Xcode 14 Beta - Unable to change selected date text color in UIDatePicker

Hi Team, In my application I have customised a UIDatePicker (set custom color for selected date) that was working correctly in iOS 15.5 and lower versions but when I run the app in iOS 16 beta, I don't see my settings for current date is working. Check the following code currently Im using,

datePicker.datePickerMode = .date
datePicker.calendar = .current
datePicker.timeZone = TimeZone(secondsFromGMT: 0)

if #available(iOS 13.4, *) {
     datePicker.preferredDatePickerStyle = .wheels
}

datePicker.setValue(UIColor.systemPink, forKeyPath: "textColor")
datePicker.setValue(false, forKey: "highlightsToday")

Please find the screenshot for more information and kindly share your feedback if any. Thanks in advance.

Replies

There is no API for what you are trying to do – in general if you see code that relies on setValue(forKey[Path]:) and that type is not specifically documented as using that API as part of its interface, then you are not using API – you are accessing implementation details of the class that are unsupported.

  • Thanks for your quick response, do you suggest any workaround ?

  • There is no workaround for this. This feature is not (and never has been) supported. If you would like to customize the text color in a date picker, you should file this as feedback.

Add a Comment