Skip to content

Fix iOS CI build failure from mixed Kotlin/Objective-C inheritance in location requester - #1

Merged
w1lderr merged 2 commits into
masterfrom
copilot/fix-failing-github-actions-job-build-ios
Jul 19, 2026
Merged

Fix iOS CI build failure from mixed Kotlin/Objective-C inheritance in location requester#1
w1lderr merged 2 commits into
masterfrom
copilot/fix-failing-github-actions-job-build-ios

Conversation

Copilot AI commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

build-ios fails in GitHub Actions at :shared:compileKotlinIosSimulatorArm64 due to Kotlin/Native rejecting mixed Kotlin and Objective-C supertypes in the iOS location requester implementation. This PR removes that invalid inheritance pattern while preserving existing location request behavior.

  • Root cause

    • IosLocationRequester implemented both:
      • Objective-C delegate types (NSObject, CLLocationManagerDelegateProtocol)
      • Kotlin interface (LocationRequester)
    • Kotlin/Native reports: Mixing Kotlin and Objective-C supertypes is not supported.
  • Code change

    • Updated shared/src/iosMain/kotlin/org/homefix/project/features/location/LocationRequester.ios.kt
    • Refactored to composition:
      • IosLocationRequester now only handles Objective-C delegate responsibilities.
      • rememberLocationRequester returns a LocationRequester wrapper that delegates request() to the Objective-C-backed instance.
  • Behavioral impact

    • No feature change intended.
    • Location permission + update flow remains unchanged; only type hierarchy wiring was adjusted for Kotlin/Native compatibility.
actual fun rememberLocationRequester(onResult: (GeoPoint?) -> Unit): LocationRequester =
    remember(onResult) {
        val requester = IosLocationRequester(onResult)
        LocationRequester { requester.request() }
    }

private class IosLocationRequester(
    private val onResult: (GeoPoint?) -> Unit,
) : NSObject(), CLLocationManagerDelegateProtocol {
    fun request() { /* unchanged logic */ }
}

Copilot AI changed the title [WIP] Fix failing GitHub Actions job 'build-ios' Fix iOS CI build failure from mixed Kotlin/Objective-C inheritance in location requester Jul 19, 2026
Copilot AI requested a review from w1lderr July 19, 2026 19:23
@w1lderr
w1lderr marked this pull request as ready for review July 19, 2026 19:24
Copilot AI review requested due to automatic review settings July 19, 2026 19:24
@w1lderr
w1lderr merged commit 23944d7 into master Jul 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the iOS CI failure in :shared:compileKotlinIosSimulatorArm64 by removing the unsupported Kotlin/Native inheritance pattern that mixed Kotlin and Objective-C supertypes in the iOS LocationRequester implementation, replacing it with a composition-based wrapper while keeping the same runtime behavior.

Changes:

  • Refactored rememberLocationRequester on iOS to return a LocationRequester SAM wrapper that delegates to an Objective-C-only delegate class.
  • Updated IosLocationRequester to implement only NSObject + CLLocationManagerDelegateProtocol (no longer implements the Kotlin LocationRequester interface).
  • Adjusted request() on iOS from override fun request() to a plain fun request() to match the new delegation approach.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants