Coder Social home page Coder Social logo

Comments (6)

vgorloff avatar vgorloff commented on June 8, 2024 1

Hi,

Should be possible. I have to check.

FYI: At the moment I am updating sample project to do more interesting things than "hello world". To simplify Swift <-> Java communication the protobuf will be used.

from swift-everywhere-toolchain.

cflorion avatar cflorion commented on June 8, 2024

I actually have an error output:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.home.hello_ndk, PID: 18004
    java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "objc_autoreleaseReturnValue" referenced by "/data/app/~~KqxlQwqa3TUqTqGewhdxaw==/com.home.hello_ndk-7-pMpv4TptG-2zyxuoccOw==/base.apk!/lib/x86/libHelloJNICore.so"...
        at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
        at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
        at java.lang.System.loadLibrary(System.java:1664)
        at com.home.helloNDK.SwiftLib.<clinit>(SwiftLib.java:6)
        at com.home.helloNDK.MainActivity$1.onClick(MainActivity.java:54)
        at android.view.View.performClick(View.java:7448)
        at android.view.View.performClickInternal(View.java:7425)
        at android.view.View.access$3600(View.java:810)
        at android.view.View$PerformClick.run(View.java:28305)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

from swift-everywhere-toolchain.

cflorion avatar cflorion commented on June 8, 2024

Wow that's amazing news !

from swift-everywhere-toolchain.

vgorloff avatar vgorloff commented on June 8, 2024

The "Protocol buffers" example added to https://github.com/vgorloff/swift-everywhere-samples repository.
Example shows how to send/receive complex data to/from Kotlin/Swift.

from swift-everywhere-toolchain.

cflorion avatar cflorion commented on June 8, 2024

This looks great! I'll give it a try as soon I can :)

I noticed your testNetworking() function. A network call usually retrieves data asynchronously. In your opinion how would Kotlin be given the data that was retrieved by Swift ?

I have no experience with JNI yet and I cannot figure out how to have a result asynchronously between Kotlin and Swift. For example if testNetworking() would retrieve a String.

How would Kotlin communicate with this function via JNI ?

public func testNetworking(completion: (String) -> Void) {
}

from swift-everywhere-toolchain.

vgorloff avatar vgorloff commented on June 8, 2024

It is theoretically doable, but making such bridge via JNI will be nightmare. I was thinking to update example without using JNI at all and using FFI instead.

Some info:

Initial idea to provide "more-less real-world example" obviously not reached when using JNI. Seems FFI+"Protocol buffers" is a way to go.

from swift-everywhere-toolchain.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.