Call Swift from C

I have seen many articles explaining how to call C functions from Swift , but I would like to study the opposite (if possible) to call Swift functions from C.

I have seen examples illustrating Swift functions in objC, but they do not bring me closer to my goal. Is this task supported?

+6
source share
1 answer

The only way to call Swift code from C code is to use Objective-C between the two.

This does not mean that it is completely impossible, but someone would have to come up with an NSInvocation like utility and wrappers for objects that do not have an accurate representation of C.

+3
source

Source: https://habr.com/ru/post/988955/


All Articles