File tree Expand file tree Collapse file tree 3 files changed +116
-0
lines changed
Demo/swift/Sources/SwiftAndroidApp Expand file tree Collapse file tree 3 files changed +116
-0
lines changed Original file line number Diff line number Diff line change 1+ // Auto-generated by Java-to-Swift wrapper generator.
2+ import JavaKit
3+ import JavaRuntime
4+
5+ @JavaClass ( " com.example.swift.HelloSubclass " )
6+ open class HelloSubclass : HelloSwift {
7+ @JavaMethod
8+ @_nonoverride public convenience init ( _ greeting: String , environment: JNIEnvironment ? = nil )
9+
10+ @JavaMethod
11+ open func greetMe( )
12+ }
13+ extension JavaClass < HelloSubclass > {
14+ @JavaStaticField ( isFinal: false )
15+ public var initialValue : Double
16+ }
Original file line number Diff line number Diff line change 1+ // Auto-generated by Java-to-Swift wrapper generator.
2+ import JavaKit
3+ import JavaKitFunction
4+ import JavaRuntime
5+
6+ @JavaClass ( " com.example.swift.HelloSwift " )
7+ open class HelloSwift : JavaObject {
8+ @JavaField ( isFinal: false )
9+ public var value : Double
10+
11+ @JavaField ( isFinal: false )
12+ public var name : String
13+
14+ @JavaMethod
15+ @_nonoverride public convenience init ( environment: JNIEnvironment ? = nil )
16+
17+ @JavaMethod
18+ open func greet( _ name: String )
19+
20+ @JavaMethod
21+ open func sayHelloBack( _ i: Int32 ) -> Double
22+
23+ @JavaMethod
24+ open func lessThanTen( ) -> JavaPredicate < JavaInteger > !
25+
26+ @JavaMethod
27+ open func do ublesToStrings( _ doubles: [ Double ] ) -> [ String ]
28+
29+ @JavaMethod
30+ open func throw Message( _ message: String ) throws
31+ }
32+ extension JavaClass< HelloSwift> {
33+ @JavaStaticField ( isFinal: false )
34+ public var initialValue : Double
35+ }
36+ /// Describes the Java `native` methods for ``HelloSwift``.
37+ ///
38+ /// To implement all of the `native` methods for HelloSwift in Swift,
39+ /// extend HelloSwift to conform to this protocol and mark
40+ /// each implementation of the protocol requirement with
41+ /// `@JavaMethod`.
42+ protocol HelloSwiftNativeMethods {
43+ func throwMessageFromSwift( _ message: String ) throws -> String
44+
45+ func sayHello( _ x: Int32 , _ y: Int32 ) -> Int32
46+ }
Original file line number Diff line number Diff line change 1+ // Auto-generated by Java-to-Swift wrapper generator.
2+ import JavaKit
3+ import JavaRuntime
4+
5+ @JavaClass ( " com.example.swift.ThreadSafeHelperClass " )
6+ open class ThreadSafeHelperClass : JavaObject {
7+ @JavaField ( isFinal: false )
8+ public var text : JavaOptional < JavaString > !
9+
10+
11+ public var textOptional : JavaString ? {
12+ get {
13+ Optional ( javaOptional: text)
14+ }
15+ set {
16+ text = newValue. toJavaOptional ( )
17+ }
18+ }
19+
20+ @JavaField ( isFinal: true )
21+ public var val : JavaOptionalDouble !
22+
23+
24+ public var valOptional : Double ? {
25+ get {
26+ Optional ( javaOptional: val)
27+ }
28+ }
29+
30+ @JavaMethod
31+ @_nonoverride public convenience init ( environment: JNIEnvironment ? = nil )
32+
33+ @JavaMethod
34+ open func getValue( _ name: JavaOptional < JavaString > ? ) -> String
35+
36+ open func getValueOptional( _ name: JavaString ? ) -> String {
37+ getValue ( name. toJavaOptional ( ) )
38+ }
39+
40+ @JavaMethod
41+ open func from( _ value: JavaOptionalInt ? ) -> JavaOptionalLong !
42+
43+ open func fromOptional( _ value: Int32 ? ) -> Int64 ? {
44+ Optional ( javaOptional: from ( value. toJavaOptional ( ) ) )
45+ }
46+
47+ @JavaMethod
48+ open func getText( ) -> JavaOptional < JavaString > !
49+
50+ open func getTextOptional( ) -> JavaString ? {
51+ Optional ( javaOptional: getText ( ) )
52+ }
53+ }
54+ extension ThreadSafeHelperClass : @unchecked Swift . Sendable { }
You can’t perform that action at this time.
0 commit comments