Implementing some .swift class methods in .mm file?
Implementing some .swift class methods in .mm file?
- Subject: Implementing some .swift class methods in .mm file?
- From: Rick Mann <email@hidden>
- Date: Mon, 14 Dec 2015 16:24:41 -0800
I need to interface with some C++ code. I can readily make an Objective-C++ class file and access that class from Swift. But I'd like to instead make a Swift class, and just put some additional method definitions in a .mm file. However, the Swift compiler doesn't see those.
So, I realized it needed to be in the bridging header. I created the following (in target "ModelShop"):
-----------------------
Job+Bridge.h:
-----------------------
#import <AppKit/AppKit.h>
#import "ModelShop-Swift.h"
@interface Job(Bridge)
- (void) processSomething;
@end
-----------------------
Job+Bridge.mm:
-----------------------
#import "Job+Bridge.h"
@implementation Job(Bridge)
- (void)
processSomething
{
}
@end
-----------------------
ModelShop-Bridging-Header.h:
-----------------------
#import "EOSManifest.h"
#import "ModelMesh.h"
#import "Job+Bridge.h"
-----------------------
Unfortunately, it doesn't like #import "ModelShop-Swift.h" in the header. It complains:
Job+Bridge.h:5:9: 'ModelShop-Swift.h' file not found
Failed to import bridging header 'ModelShop/ModelShop-Bridging-Header.h'
Is there any way to do what I want without having to make a completely separate class declaration, or implement the entire class in Obj-C++?
Thanks,
--
Rick Mann
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden