ObjC Link

Language Bridge generates bindings with automatic type conversion. Additionally, if you call ObjC from your platform dependent part of C++ code, you can use ObjC Link API to manually convert between ObjC and C++ types.


#include <scapix/link/objc/convert.h>

using namespace scapix::link::objc;

void test()
    // Use convert_cpp() and convert_objc() functions to convert between C++ and Objective-C types.
    // This works for any type supported by scapix::link::objc::convert<> interface,
    // which supports many STL types and can be extended for your own types.

    auto version = convert_cpp<std::string>([[NSProcessInfo processInfo] operatingSystemVersionString]);
    auto arguments = convert_cpp<std::vector<std::string>>([[NSProcessInfo processInfo] arguments]);
    auto environment = convert_cpp<std::map<std::string, std::string>>([[NSProcessInfo processInfo] environment]);

See list of supported types.