I just created the Data/CRUD project with codegen.
My data model classes have 1:1 and 1:N relations:
class Address : NSObject {
var street : NSString?
var city: NSString?
var state : NSString?
}
class Contact : NSObject {
var objectId : String?
var name : String?
var age : Int = 0
var phone : String?
var title : String?
var homeAddress : Address?
var weight : Double = 0.0
}
class PhoneBook : NSObject {
var objectId : String?
var owner : Contact?
var contacts : [Contact] = []
var status : Int = 0
}
In code generated project these classes are:
#import <Foundation/Foundation.h>
@interface Address : NSObject
@property (nonatomic, strong) NSDate *created;
@property (nonatomic, strong) NSString *state;
@property (nonatomic, strong) NSString *city;
@property (nonatomic, strong) NSString *ownerId;
@property (nonatomic, strong) NSString *street;
@property (nonatomic, strong) NSDate *updated;
@property (nonatomic, strong) NSString *objectId;
@end
@class Address;
@interface Contact : NSObject
@property (nonatomic, strong) NSString *ownerId;
@property (nonatomic, strong) NSDate *created;
@property (nonatomic, strong) NSNumber *age;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *title;
@property (nonatomic, strong) NSDate *updated;
@property (nonatomic, strong) NSString *objectId;
@property (nonatomic, strong) NSString *phone;
@property (nonatomic, strong) Address *homeAddress;
@end
#import <Foundation/Foundation.h>
@class Contact;
@interface PhoneBook : NSObject
@property (nonatomic, strong) NSString *objectId;
@property (nonatomic, strong) NSDate *updated;
@property (nonatomic, strong) NSString *ownerId;
@property (nonatomic, strong) NSDate *created;
@property (nonatomic, strong) Contact *owner;
@property (nonatomic, strong) NSMutableArray *contacts;
-(void)addToContacts:(Contact *)contact;
-(void)removeFromContacts:(Contact *)contact;
-(NSMutableArray *)loadContacts;
-(void)freeContacts;
@end
I didn’t find any #include … directive in .h files, only @class …
Please, provide your classes, which demonstrated this issue, we can’t reproduce it.