Objective-C Library
You can open this sample inside an IDE using the IntelliJ native importer, Eclipse Buildship, or Nokee’s Xcode IDE plugin |
This sample shows how to build a native library implemented in Objective-C with Gradle. The library has no dependencies, and the build has a minimal configuration.
build.gradle
plugins {
id 'dev.nokee.objective-c-library'
id 'dev.nokee.xcode-ide'
}
import dev.nokee.platform.nativebase.SharedLibraryBinary
library.variants.configureEach {
binaries.configureEach(SharedLibraryBinary) {
linkTask.configure {
linkerArgs.add('-lobjc')
}
}
}
build.gradle.kts
plugins {
id("dev.nokee.objective-c-library")
id("dev.nokee.xcode-ide")
}
import dev.nokee.platform.nativebase.SharedLibraryBinary
library.variants.configureEach {
binaries.configureEach(SharedLibraryBinary::class.java) {
linkTask.configure {
linkerArgs.add("-lobjc")
}
}
}
To build the library:
$ ./gradlew assemble BUILD SUCCESSFUL 2 actionable tasks: 2 executed
The native library produced inside ./build/libs/main
directory:
$ ls ./build/libs/main/* ./build/libs/main/libobjective-c-library.dylib
For more information, see Objective-C Library Plugin reference chapter and Building Native Projects chapter.