I am searching how to get not managed property names and types of a NSManagedObject subclass.
here is few sample code to help me to ask my question :
@objc(Account)
public class Account: NSManagedObject {
@NSManaged var bic: String
@NSManaged var number: String
@NSManaged var operations: Set<Operation>
@NSManaged var servicesSubscriptions: Set<ServiceSubcription>
// and more.
}
extension Account
{
public var title : String {
get
{
return (self.bic + " " + self.number)
}
set(value)
{ // do parsing stuf, and
self.bic = parse[0];self.number = parse[1]
}
}
}
I have found many ways to get property names using reflect() function. reflect() do not work with NSManagedObject at all. (like this simple one)
I have found examples with class_copyPropertyList function, which do not work at all with NSManagedObject. (I bet it is used internally in reflect function)
I have found many ways to get Attributes (or relations) of managed objects using NSEntityDescription. (like this one). Which work and get back bic
and number
, but not title
.
So my question is : How to get back my title
property, and its type, dynamically at run time ?
Thank you for any help
Aucun commentaire:
Enregistrer un commentaire