Document that suspend fun invoke()
becomes __invoke()
in Swift
#39
Replies: 3 comments 4 replies
-
Hi! Sorry about that. I was pretty sure this behavior was documented, but now I can't find where. The documentation underwent multiple revisions, so it must have been removed by accident. You are correct that the prefix is there for a reason similar to enums - avoiding name collisions with the generated code. The wrapper async function is an extension, so it's not possible to override it directly. Therefore, we can't just remove the original function; instead, we change its name so that it's still possible to override it. |
Beta Was this translation helpful? Give feedback.
-
@chrisbanes Do you normally implement the I'm asking because we have a prototype where the prefix isn't added, but the only available variant is the one with callback (because we disable the automatic async conversion from ObjC). So if you implement the Additionally, if you use any |
Beta Was this translation helpful? Give feedback.
-
I added a mention about this use case to the documentation: https://skie.touchlab.co/features/suspend#overriding-suspend-functions |
Beta Was this translation helpful? Give feedback.
-
We make heavy usage of suspending invoke functions, like:
These allows us to implement certain actions/interactions 'natively' on each platform. Without SKIE, these interfaces can be implemented in Swift like so:
With SKIE, Xcode wouldn't compile and it took me a while to workout that the function name is now called
__invoke()
in Swift, rather thaninvoke()
. I'm sure there's a reason for this (similar to enums), but it would be handy if this was documented.Beta Was this translation helpful? Give feedback.
All reactions