forked from xamarin/xamarin-macios
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[runtime] Add support for additional type encodings. Fixes xamarin#18562
. Fixes xamarin#18562.
- Loading branch information
1 parent
8ebceb0
commit 699e94b
Showing
5 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,38 @@ | ||
import Foundation | ||
|
||
@objc(SwiftTestClass) | ||
@available(iOS 15, tvOS 15, macOS 12, macCatalyst 12, watchOS 8, *) | ||
public class SwiftTestClass : NSObject { | ||
@objc | ||
public func SayHello() -> String { | ||
return "Hello from Swift" | ||
} | ||
|
||
@objc | ||
// encoding for 'message': @"NSString" | ||
public func DoSomething(message: String) -> String { | ||
return message | ||
} | ||
|
||
@objc | ||
// encoding for 'message': @"NSString" | ||
// objc encoding for implicit callback: @?<v@?@"NSString"> | ||
public func DoSomethingAsync(message: String) async -> String { | ||
do { | ||
try await Task.sleep(nanoseconds: 1) | ||
} catch {} | ||
return message; | ||
} | ||
|
||
@objc | ||
// objc encoding for 'message': @"NSString" | ||
// objc encoding for 'complexParameter': @?<@"NSString"@?@?<q@?s>> | ||
// in particular this argument has nested <<>> | ||
// objc encoding for implicit callback: @?<v@?@"NSString"> | ||
public func DoSomethingComplexAsync(message: String, complexParameter: @escaping ((Int16) -> Int64) -> String?) async -> String { | ||
do { | ||
try await Task.sleep(nanoseconds: 1) | ||
} catch {} | ||
return message; | ||
} | ||
} |