14 auto cls = objc_getClass(name.c_str());
15 auto inst = class_createInstance(cls,
sizeof(T) );
23 return ClassWrapper<T>{objc_allocateClassPair(
reinterpret_cast<Class
>(
"NSObject"_cls), name.c_str(), 0)};
37 class_addProtocol(m_class, objc_getProtocol(name.c_str()));
42 objc_registerClassPair(m_class);
45 template <
typename FunctionT>
46 void addMethod(std::string
const& name, FunctionT func)
49 m_class, sel_registerName(name.c_str()),
reinterpret_cast<IMP
>(func), encodeType<FunctionT>().c_str());
void addProtocol(std::string const &name)
Definition: class.hpp:35
static auto createInstance(std::string const &name)
Definition: class.hpp:12
static auto createNsObjectClassPair(std::string const &name)
Definition: class.hpp:21
void addMethod(std::string const &name, FunctionT func)
Definition: class.hpp:46
Class native() const noexcept
Definition: class.hpp:26
void registerClassPair()
Definition: class.hpp:40
ClassWrapper(Class cls)
Definition: class.hpp:31