NativeScript / ios-jsc

NativeScript for iOS using JavaScriptCore
http://docs.nativescript.org/runtimes/ios
Apache License 2.0
298 stars 59 forks source link

Cannot export class, interface in Swift framework when run TNS_TYPESCRIPT_DECLARATIONS_PATH with #if 0 #elif defined(__arm64__) && __arm64__ #1288

Closed nguyenhuutinh closed 3 years ago

nguyenhuutinh commented 3 years ago

hi team, I have a local framework, working with native projects and I want to build the framework for NS as a plugin.

I've done integrating android .aar to NS project but for iOS, I got some problem.

After I run TNS_TYPESCRIPT_DECLARATIONS_PATH="$(pwd)/app/typings" tns build ios I got a lot of generated classes, including my framework

Screenshot 2020-12-10 at 5 35 33 PM

But the problem is generated file only OBJECT_C functions, didn't include my class / functions (SWIFT) even I added a TestClass to check but it wasn't generated it.

import Foundation
@objc(TestClass)
public class TestClass: NSObject {
    @objc public func echo(param: String) -> String {
        return param
    }
}

In my framework, there is a -swift.h class which contain our swift class / functions, but I couldn't find out why it didn't generate


SWIFT_CLASS_NAMED("TestClass")
@interface TestClass : NSObject
- (NSString * _Nonnull)echoWithParam:(NSString * _Nonnull)param SWIFT_WARN_UNUSED_RESULT;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
@end

Do you know what I'm wrong? Thank you

nguyenhuutinh commented 3 years ago

fixed it by correct objc-swift. thanks