How to call a function in .c file from .m or .swift files in ios?

139 views Asked by At

here my question was, i have a .swift file and i have .c ('C' file) with some functions. I want to call those functions from .swift file how can i do that?

Example:

In my product.c file i have this function

static unsigned short get_vendor_id(IOHIDDeviceRef device)
{
    return get_long_property(device, CFSTR(kIOHIDVendorIDKey));
}

Now how can i import this product.c file in my viewcontroller.swift and how to call this get_vendor_id method from .switf and how to take the return value?

First of all is it possible?

Thanks

0

There are 0 answers