Contacts: Filter birthdays not containing year

Using:

selectedContacts = contacts.filter ({ $0.birthday?.year != nil })

Code compiles but contact still shows. How to select the correct data element from the contacts birthday when it doesn’t contain a year?

func contactPicker(_ picker: CNContactPickerViewController, didSelect contacts: [CNContact]) {
//selectedContacts = contacts.filter ({ $0.birthday?.value(for: .year) != nil })
selectedContacts = contacts.filter ({ $0.birthday?.year != nil })
//value(for: .year) != nil })

Replies

My question: what is the predicate for not enabling a contact when there is no birthyear set.

contactPickerViewController.predicateForEnablingContact = NSPredicate(format:"birthday.year.@count > 0")

The above provides an error at runtime, omitting year does work.