I would like an NSManagedObject class to comply with a protocol that I have defined in Swift.
The protocol defines only a number of properties that the NSManagedObject should have:
@objc
public protocol PLCNetworkUnit {
var objectID: NSManagedObjectID { get }
var type: NSNumber { get }
var url: String { get }
var port: NSNumber { get }
var wifiPort: NSNumber { get }
var wifiSSID: String { get }
var wifiUrl: String { get }
var modbusOffset: NSNumber { get }
}
For the most part, this works, but the compiler complains with the following warning:
'copy' attribute on property 'modbusOffset' does not match the property inherited from 'PLCNetworkUnit'
This is the definition of the NSManagedObject class:
@interface SPSStation (CoreDataProperties) <PLCNetworkUnit>
+ (NSFetchRequest<SPSStation *> *)fetchRequest;
@property (nullable, nonatomic, copy) NSNumber *activeTimeSwitches;
@property (nullable, nonatomic, copy) NSNumber *modbusOffset;
@property (nullable, nonatomic, copy) NSString *name;
@property (nullable, nonatomic, copy) NSNumber *port;
@property (nullable, nonatomic, copy) NSNumber *type;
@property (nullable, nonatomic, copy) NSString *url;
@property (nullable, nonatomic, copy) NSNumber *wifiPort;
@property (nullable, nonatomic, copy) NSString *wifiSSID;
@property (nullable, nonatomic, copy) NSString *wifiUrl;
@property (nullable, nonatomic, retain) NSSet<Gear *> *gears;
@property (nullable, nonatomic, retain) DatabaseProfile *profile;
@property (nullable, nonatomic, retain) NSSet<Program *> *programs;
@property (nullable, nonatomic, retain) NSSet<Sensor *> *sensor;
@property (nullable, nonatomic, retain) NSSet<SystemValue *> *systemValues;
@property (nullable, nonatomic, retain) NSSet<TimeSwitch *> *timer;
@end
How do I get the NSManagedObject-based class to comply with the Swift protocol without the compiler complaining?