Ejemplo n.º 1
0
        public NativeClassInstance CreateInstance(object parent)
        {
            if (!registered)
            {
                throw new InvalidOperationException("Native class is not yet fully declared and registered");
            }

            IntPtr instance = ObjC.Call(Handle, "new");

            var parentHandle = GCHandle.Alloc(parent, GCHandleType.Normal);

            ObjC.SetVariableValue(instance, ivar, GCHandle.ToIntPtr(parentHandle));

            return(new NativeClassInstance(instance, parentHandle));
        }