I have an issue where in Swift I have a class defined named Person, and when talking to some objective-c code, it will try to create new instances of that class.
Obviously NSClassFromString(@"Person") fails, because it needs to be a fully qualified name such as DBAccess_Test.Person.
My question is, am I able to programatically generate the DBAccess_Test. portion, by possibly searching through a registry of classes perhaps?
The reason being, that for an ORM we maintain, a Swift programmer may well decide to have all of his storage classes within a separate namespace to the application. But we wish to maintain standard table naming practices that match the names of the class as understood by the developer.
For instance, instead of a query being:
NSArray* r = [[[[Person query]
where:@"surname IN (SELECT surname FROM Employees)"]
orderBy:@"forename"]
fetch];
it would become:
NSArray* r = [[[[Person query]
where:@"surname IN (SELECT surname FROM DBAccess_Test_Employees)"]
orderBy:@"forename"]
fetch];
The ORM already has a bit of an identity crisis. We just wish to keep in check the table names, with the class names that the programmer will use.
Thanks in advance foe your help.