File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
Samples/SwiftKitSampleApp/src/main/java/com/example/swift Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -46,11 +46,11 @@ static void examples() {
46
46
47
47
MySwiftClass obj = new MySwiftClass (2222 , 7777 );
48
48
49
- SwiftKit .retain (obj .$memorySegment ());
50
- System .out .println ("[java] obj ref count = " + SwiftKit .retainCount (obj .$memorySegment ()));
49
+ // SwiftKit.retain(obj.$memorySegment());
50
+ // System.out.println("[java] obj ref count = " + SwiftKit.retainCount(obj.$memorySegment()));
51
51
52
52
obj .voidMethod ();
53
- obj .takeIntMethod (42 );
53
+ // obj.takeIntMethod(42);
54
54
55
55
System .out .println ("DONE." );
56
56
}
Original file line number Diff line number Diff line change @@ -71,8 +71,8 @@ struct SwiftThunkTranslator {
71
71
return
72
72
"""
73
73
@_cdecl( " \( raw: funcName) " )
74
- public func \( raw: funcName) () -> Any /* Any.Type */ {
75
- return \( raw: nominal. swiftTypeName) .self
74
+ public func \( raw: funcName) () -> UnsafeMutableRawPointer /* Any.Type */ {
75
+ unsafeBitCast( \( raw: nominal. swiftTypeName) .self, to: UnsafeMutableRawPointer.self)
76
76
}
77
77
"""
78
78
}
@@ -89,9 +89,10 @@ struct SwiftThunkTranslator {
89
89
[
90
90
"""
91
91
@_cdecl( " \( raw: thunkName) " )
92
- public func \( raw: thunkName) ( \( raw: st. renderSwiftParamDecls ( function, paramPassingStyle: nil ) ) ) -> Any /* \( raw: parent. swiftTypeName) */ {
92
+ public func \( raw: thunkName) ( \( raw: st. renderSwiftParamDecls ( function, paramPassingStyle: nil ) ) ) -> UnsafeMutableRawPointer /* \( raw: parent. swiftTypeName) */ {
93
93
print( " [swift] init class \( raw: parent. swiftTypeName) " )
94
- return \( raw: parent. swiftTypeName) ( \( raw: st. renderForwardSwiftParams ( function, paramPassingStyle: nil ) ) )
94
+ let _self = \( raw: parent. swiftTypeName) ( \( raw: st. renderForwardSwiftParams ( function, paramPassingStyle: nil ) ) )
95
+ return unsafeBitCast(_self, to: UnsafeMutableRawPointer.self)
95
96
}
96
97
"""
97
98
]
You can’t perform that action at this time.
0 commit comments