Skip to content

Commit 466b0dc

Browse files
committed
Delete the five hand-matched scalar callback externals
1 parent 7eaaee9 commit 466b0dc

2 files changed

Lines changed: 15 additions & 48 deletions

File tree

‎Sources/ComposeUI/SwiftCallbackSink.swift‎

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
// SwiftCallbackSink.swift
33
// ComposeUI
44
//
5-
// The entire Kotlin→Swift bridge surface. The JNI symbol for each method
6-
// derives from THIS signature — the Kotlin `external` declarations in
7-
// SwiftCallbackSink.kt must stay exactly in sync, and this class must never
8-
// grow per-view methods.
5+
// The one remaining hand-matched Kotlin→Swift external: a lazy-row query
6+
// returning a materialized `ViewNode` subtree. It can't move to the generated
7+
// `BridgeExport` bindings because an exported Swift function can't return a
8+
// JavaKit-wrapped type. The JNI symbol derives from THIS signature, so the
9+
// Kotlin `external fun itemNode` in SwiftCallbackSink.kt must stay in sync.
10+
// The five scalar event callbacks now cross through `BridgeExport`.
911
//
1012

1113
import SwiftJava
@@ -17,31 +19,6 @@ open class SwiftCallbackSink: JavaObject {
1719
@JavaImplementation("com.pureswift.swiftui.SwiftCallbackSink")
1820
extension SwiftCallbackSink {
1921

20-
@JavaMethod
21-
func invokeVoid(_ id: Int64) {
22-
BridgeRuntime.current?.invokeVoid(id)
23-
}
24-
25-
@JavaMethod
26-
func invokeBool(_ id: Int64, _ value: Bool) {
27-
BridgeRuntime.current?.invokeBool(id, value)
28-
}
29-
30-
@JavaMethod
31-
func invokeDouble(_ id: Int64, _ value: Double) {
32-
BridgeRuntime.current?.invokeDouble(id, value)
33-
}
34-
35-
@JavaMethod
36-
func invokeInt(_ id: Int64, _ value: Int32) {
37-
BridgeRuntime.current?.invokeInt(id, Int(value))
38-
}
39-
40-
@JavaMethod
41-
func invokeString(_ id: Int64, _ value: String) {
42-
BridgeRuntime.current?.invokeString(id, value)
43-
}
44-
4522
@JavaMethod
4623
func itemNode(_ id: Int64, _ index: Int32) -> ViewNodeObject? {
4724
BridgeRuntime.current?.itemNode(id, Int(index))
Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
package com.pureswift.swiftui
22

3-
// The entire Kotlin→Swift bridge surface: five externals dispatching event
4-
// callback ids into the Swift registry. The JNI symbol for each derives from
5-
// the SWIFT @JavaImplementation signature — these declarations and the Swift
6-
// counterparts in SwiftCallbackSink.swift must stay exactly in sync, and this
7-
// class must never grow per-view methods.
8-
class SwiftCallbackSink : CallbackSink {
9-
10-
external override fun invokeVoid(id: Long)
11-
12-
external override fun invokeBool(id: Long, value: Boolean)
13-
14-
external override fun invokeDouble(id: Long, value: Double)
15-
16-
external override fun invokeInt(id: Long, value: Int)
17-
18-
external override fun invokeString(id: Long, value: String)
19-
20-
// A lazy row query: returns the materialized row subtree, or null.
21-
external override fun itemNode(id: Long, index: Int): ViewNode?
3+
// The one remaining hand-matched Kotlin→Swift external: a lazy-row query that
4+
// returns a materialized `ViewNode` subtree. jextract can't express it (an
5+
// exported Swift function can't return a JavaKit-wrapped type), so this stays a
6+
// hand-written external whose JNI symbol matches the Swift @JavaImplementation
7+
// in SwiftCallbackSink.swift. The five scalar event callbacks moved to the
8+
// generated `BridgeExport` bindings — see JextractCallbackSink.
9+
class SwiftCallbackSink {
10+
11+
external fun itemNode(id: Long, index: Int): ViewNode?
2212
}

0 commit comments

Comments
 (0)