Skip to content

Add Swift/Kotlin native sample support, runtime validator, and iPhoneBuilder improvements#4684

Open
liannacasper wants to merge 7 commits intomasterfrom
codex/add-swift-support-for-codename-one-interfaces
Open

Add Swift/Kotlin native sample support, runtime validator, and iPhoneBuilder improvements#4684
liannacasper wants to merge 7 commits intomasterfrom
codex/add-swift-support-for-codename-one-interfaces

Conversation

@liannacasper
Copy link
Copy Markdown
Collaborator

Motivation

  • Make the native interface sample support Swift on iOS and Kotlin on Android and document that iOS native code can be Swift as well as Objective-C.
  • Ensure the sample validates at runtime that the native implementation language matches the platform.
  • Make the iOS native peer instantiation more robust by resolving classes in the main bundle when needed.

Description

  • Updated package documentation (package-info.java and package.html) to mention Swift as a supported iOS native implementation language.
  • Enhanced IPhoneBuilder to use a new cn1_createNativeInterfacePeer helper that looks up Objective-C/Swift classes by name and falls back to the app bundle-prefixed name, and changed native peer handling to use generic id values.
  • Added a sample native interface SwiftKotlinNative and platform implementations: a Kotlin implementation SwiftKotlinNativeImpl.kt for Android and a Swift implementation com_codenameone_examples_hellocodenameone_SwiftKotlinNativeImpl.swift for iOS.
  • Added NativeInterfaceLanguageValidator and wired it into the sample app (HelloCodenameOne.kt) to assert that Android uses kotlin and iOS uses swift implementations at runtime.

Testing

  • Built the modified modules (maven plugin and sample scripts) to verify compilation of the updated IPhoneBuilder and new sample source files; the build succeeded.
  • Executed the hellocodenameone sample build for Android and iOS to verify native sample files are compiled into the respective platform artifacts; the builds succeeded.

Codex Task

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

@shai-almog
Copy link
Copy Markdown
Collaborator

shai-almog commented Apr 1, 2026

Compared 33 screenshots: 33 matched.

Native Android coverage

  • 📊 Line coverage: 7.60% (3883/51069 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 5.99% (19243/320996), branch 2.84% (884/31175), complexity 3.55% (1058/29821), method 6.25% (869/13902), class 10.40% (192/1846)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/712 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 7.60% (3883/51069 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 5.99% (19243/320996), branch 2.84% (884/31175), complexity 3.55% (1058/29821), method 6.25% (869/13902), class 10.40% (192/1846)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/712 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants