# multiplatform

Sylvain Patenaude

01/16/2020, 4:18 PM
I wrote an SDK that is only comprised of static methods. At first I had those methods wrapped in objects like this:
Copy code
// File 'Name3.kt'
package name1.name2

object Name3 {
    fun Function1(): String {...}
After, I removed the "object" layer, thinking I would simplify client calls. However, when calling my Android/jvm SDK from a Java client, for instance, it looks awkward since Java doesn't support package-level functions. So it looks like this from the Java client:
Copy code
import name1.name2.Name3Kt;

void func() {
    String s = Name3Kt.Function1();
Based on that, shouldn't I revert to my 1st solution of having my static functions wrapped in an object, so the client call (in Java) would look like this instead?
Copy code
import name1.name2.Name3Kt; //SDK functions at package-level
import name1.name2.Name3;     //SDK functions at object-level

String s = Name3Kt.Function1(); //SDK functions at package-level
String s = Name3.Function1();     //SDK functions at object-level


01/16/2020, 5:52 PM
👍 1

Sylvain Patenaude

01/23/2020, 7:15 PM
It works well for Android/Jvm clients, but it doesn't solve the "issue" for an iOS consumer. It still remains Name3Kt.function1(). 🙁 Is there a way similar to
for iOS or should I go back to putting my functions in an
named "Name3"?
It looks like even with an
named "MyObject" for instance, a call from iOS (Swift for instance) would look like this: MyObject*Kt*.function()
I can't believe there's nothing similar to
for iOS. Now when documenting my SDK, I need 2 different APIs for Android and iOS: • Android: MyObjectName.someFunction() • iOS: MyObjectName*Kt*.someFunction() This is really annoying.