https://kotlinlang.org logo
#ios
Title
# ios
f

Foso

03/07/2021, 6:43 PM
Hi, i'm trying to use XCTest from Kotlin but i cant figure out how to generate the bindings with cinterop. Can someone give me an example? I will post my (non-working) code in the thread.
This is my .def file
Copy code
language = Objective-C
package = platform.XCTest
depends = UIKit
modules = XCTest
linkerOpts= -weak_framework XCTest -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/UIKit.framework -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks/
compilerOpts= -weak_framework XCTest -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/
And i use this in my build.gradle.kts
Copy code
ios {
        binaries {
            framework {
                baseName = "shared"
            }
        }
        val main by compilations.getting
       val interop= main.cinterops{
            this.create("xctest"){
                this.defFile =  File("/Users/jklingenberg/Code/2021/Testapp/shared/src/iosMain/xctest_iOSX64.def")
            }
        }
    }
It looks like cinterop is doing something, but Intellij can't find any imports for it.
66 Views