var currentContact = CNLabeledValue<NSCopying & NSSecureCoding>()
I want to create a variable which will store the value from the contact which can be either a phone number or an email address
var currentContact = CNLabeledValue<NSCopying & NSSecureCoding>()
currentContact = self.itemsInAcontact[section][0] as! CNLabeledValue
if ((currentContact.value as? CNPhoneNumber) != nil){
phoneNumber = currentContact.value as! CNPhoneNumber
if let y = phoneNumber?.value(forKey: "initialCountryCode"){
cell.nameLabel!.text = "\(phoneNumber!.value(forKey: "initialCountryCode") as! String)\(phoneNumber!.stringValue)"
}else{
cell.nameLabel!.text = "\(phoneNumber!.stringValue)"
}
}else{
cell.nameLabel!.text = currentContact.value as! String
}
Here i am trying to display the contact number or email address available in a no name type contact inside the cell of a tableview, but I'm getting error on declaration of var currenctContact
The error message: "'NSCopying & NSSecureCoding' cannot be used as a type conforming to protocol 'NSSecureCoding' because 'NSSecureCoding' has static requirements".