Swift doesn't see some Objective-C functions or properties

Hello,

I have a following problem. I define an Objective-C interface as such:

Code Block objective-c
extern @interface CGRenderOptions : NSObject
- (id _Nonnull) init;
- (void)makeInputTransform:(NSString* _Nullable)transform;
- (void)makeOutputTransform:(NSString* _Nullable)transform;
@property(assign) BOOL ColorManaged;
@property(assign) CGBypassOption Bypass;
@property(assign) BOOL FalseColor;
@property(assign) MTLSize* _Nullable OutputSize;
@property(assign) NSString* _Nullable InputTransform;
@property(assign) NSString* _Nullable OutputTransform;
@property(assign) NSString* _Nullable WatermarkString;
@end


This header is then imported to a Swift library and the following items are not visible: InputTransform, OutputTransform, makeInputTransform and makeOutputTransform.

These were added recently, so I thought it's an issue with build and compilation, but I cleaned all the build folders, and I still can't get it to work.

Any ideas?


Answered by DTS Engineer in 670770022
Having properties of an object type (like NSString *) with the assign attribute is weird. The standard Cocoa paradigm is that these are either strong or copy (depending on whether the class supports NSCopying). Without that you can run into horrible memory management issues, where someone assigns an object to a property, which doesn’t retain it, then releases their reference to the object, leaving the property’s reference dangling.

Did you do this deliberately? If not, switch to either strong or copy and see if that helps.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Accepted Answer
Having properties of an object type (like NSString *) with the assign attribute is weird. The standard Cocoa paradigm is that these are either strong or copy (depending on whether the class supports NSCopying). Without that you can run into horrible memory management issues, where someone assigns an object to a property, which doesn’t retain it, then releases their reference to the object, leaving the property’s reference dangling.

Did you do this deliberately? If not, switch to either strong or copy and see if that helps.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
That could have been it. Many thanks!
Swift doesn't see some Objective-C functions or properties
 
 
Q