https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
z

ZabGo

05/04/2020, 11:01 AM
I am trying to integrate an Objective-C framework into my Kotlin muliplatform project so that I can develop an iOS app. It’s working fine on Android. In term of Objective-C I am closer to zero than hero so I am not sure where the issue could come from. Basically I have a lot of headers looking like that:
Copy code
typedef NS_ENUM(NSInteger, cameraControl){
	CameraPanLeft,
	CameraPanRight,
	CameraTiltUp,
	// etc.
};
@interface ControlCapabilities : NSObject
{
}

	@property BOOL property_1;
	@property BOOL property_2;
	@property BOOL property_3

@end
And I get the error :
error: function definition declared 'typedef'.
I could not find anywhere an issue with a similar error message. I tried to add custom declarations in my def file: ---
Copy code
#import <Foundation/Foundation.h>
static inline int NS_ENUM(int NSInteger, int NSInteger) {
  return NS_ENUM(NSInteger, cameraControl);
}

OR

static inline int NS_ENUM(int NSInteger, int cameraControl) {
    return typedef NS_ENUM(NSInteger, cameraControl){
       	   CameraPanLeft,
	       CameraPanRight,
	       CameraTiltUp,
	       // etc.
    };
}
I tried to add options to compilerOpts or linkerOpts e.g -framework Foundation, etc. None of the above fixed the issue.  If anyone has an idea why this issue is popping up, that would be great! Thanks in advance
Adding
Foundation/Foundation.h
as the first entry of the list of headers solved this issue. However now it does not find the headers that are included in the first header after
Foundation/Foundation.h
. Even though they are in the list. I have the error 
fatal error: 'path/to/the/header.h' file not found
I've seen that using
modules
in the
.def
file instead of the
headers
could work but it did not for me. Why a header cannot have access to the other headers that are in the list of
headers
and in
headerFilter
? I don't really know where to look for now. If anyone have an idea that would be great. Thanks!