Closed maicol07 closed 8 months ago
Yes it's possible, just edit the build.gradle.kts
to your needs.
I'm not a iOS developer myself, however I think you have to configure it like this:
iosX64{
binaries {
sharedLib() // choose one
staticLib() // choose one
framework {
baseName = "sekret"
isStatic = // depends on the chosen at top
}
}
}
As I said I'm not a iOS developer so I can't test or make sure all references are resolved, but the library is fully native compatible.
🤔 I don't think it works... I get the same errors on two machines (Windows and MacOS) when generating native libraries... These are all the not-found references:
Which version do you use?
1.0.1
Please update to version 2.0.0-alpha-01
. It's safe to use for your purpose.
It's important to bump the version in sekret/build.gradle.kts
(the file we discussed before) as well.
Make sure to follow the "upgrade guide": https://github.com/DatL4g/Sekret/releases
After updating the gradle plugin you could also use the new generateSekretBuildScript
gradle task, to make sure everything is setup correctly.
Same issue even after upgrading to 2.0a1. The build script command actually removes iosMain from the jni blocks
iOS doesn't work in the jni build, since iOS doesn't run on the JVM.
Only android
, linux
, macos
and windows
is supported there.
Removing iosMain
from jniNativeMain
and jniMain
will resolve all issues.
iOS runs completely native so all you need are the ios targets, native bindings are generated accordingly.
Ok, thank you. However, doing this I can't find the Sekret and NativeLoader classes in iosMain. How can I access my secrets?
The NativeLoader is needed on android and jvm only.
iOS (and other native targets) have direct bindings. Please take a look here: https://kotlinlang.org/docs/native-objc-interop.html#top-level-functions-and-properties
Works! Thank you! For future readers, if you have a secret like this:
MY_SECRET="123"
Just use it as a function in your iosMain code:
mySecret()
This may change in the next version to Sekret.mySecret()
Yeah, that may be better, so it can be used without extra code in the common module
New release has a common Sekret
class now
https://github.com/DatL4g/Sekret/releases/tag/v2.0.0-alpha-04
Hi, is it possible to generate iOS native files? I've added
However, this gives me a lot of undefined references errors. Can you help me? Thanks