Ad

ModuleName-Swift.h Generated With Missing Methods

- 1 answer

I have the following Swift class

public class Model :   NSObject
{
    override init()
    { (...) }

    class func  fileListHasBeenUpdatedEvent() -> String
    { (...) }

    func    fileExtensions() -> [String]
    { (...) }

    func    filesWithExtension(ext : String) -> [ModelFile]
    { (...) }

    func addFilesWithThoseURLs(urlList:[NSURL])
    { (...) }
    }

    func fileListHasBeenUpdated(modelElement : EasyModelElementProtocol)
    { (...) }
}

and the generated ModuleName-Swift.h looks like

@interface Model : NSObject
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
+ (NSString * __nonnull)fileListHasBeenUpdatedEvent;
- (NSArray<NSString *> * __nonnull)fileExtensions;
- (void)addFilesWithThoseURLs:(NSArray<NSURL *> * __nonnull)urlList;
@end

So I am clearly missing the filesWithExtension: and fileListHasBeenUpdated:. I have cleaned the Derived data several times and rebuilt in many ways...

Is this a known XCode bug ? Or am I missing something ?

Ad

Answer

Just a guess but I imagine EasyModelElementProtocol and ModelFile are objects that can't be represented in Objective C.

EasyModelElementProtocol needs to conform to the NSObject and i'm guessing that ModelFile might be either a struct or a Class that doesn't inherit from NSObject

IIRC you should be able to test this by marking the functions as @objc and the compiler should inform you about exactly why it can't be represented in Objective C

Ad
source: stackoverflow.com
Ad