Alex Styl
04/18/2024, 12:03 PMfoo()
in swift
source: https://kotlinlang.org/docs/native-objc-interop.html#top-level-functions-and-propertiesDarron Schall
04/18/2024, 12:40 PMfoo
is translated into an Objective-C class method, where the class is the filename. The generated Objective-C header for the the above example looks something like this:
__attribute__((objc_subclassing_restricted))
__attribute__((swift_name("MyLibraryUtilsKt")))
@interface MyLibraryUtilsKt : SharedBase
+ (void)foo;
@end
Since foo
is translated to a class method, it must be called via the class. (It only looks like it gets called via the file name... that's because the file name is used as the class name).Daniel Seither
04/18/2024, 12:59 PMJon Bailey
04/18/2024, 1:07 PMbrandonmcansh
04/18/2024, 2:54 PM