Hello There;
Using macOS 12.5 & Xcode 13.4 I am trying to subclass CNContact and bumping into an issue that I do not understand!
class MyContact: CNContact {
var newVariable :String = ""
...
}
I have loaded contactArray:[CNContact] now as I iterate over this array I would like to typecast the instance of CNContact to an instance of MyContact.
for thisContact in contactArray {
if let myK:MyContact = thisContact as? MyContact {
//do something
}
}
program flow simply never proceeds into the if let statement...
if I try to force this issue:
let myK:MyContact = thisContact as! MyContact
I get the error:
Could not cast value of type 'CNContact' (0x2057a35b8) to 'XYZ.MyContact' (0x102484490).
Please help me accomplish my goal - what am I not understanding here? All help appreciated!
Steve