SwiftClassObject(SwiftClassPriv classPriv, IntPtr classStart) { classObj = classPriv; if (classStart != IntPtr.Zero) { vtableStart = classStart + Marshal.SizeOf(typeof(SwiftClassPriv)); } }
SwiftClassObject(IntPtr p) { if (p == IntPtr.Zero) { throw new ArgumentNullException(nameof(p)); } classObj = (SwiftClassPriv)Marshal.PtrToStructure(p, typeof(SwiftClassPriv)); vtableStart = p + Marshal.SizeOf(typeof(SwiftClassPriv)); }
public static SwiftClassObject FromSwiftObject(ISwiftObject obj) { SwiftClassPriv classPriv = GetSwiftClassPriv(obj); if (!classPriv.IsSwiftTypeMetadata) { throw new NotSupportedException("class object is an Objective C class."); } return(new SwiftClassObject(classPriv, SwiftCore.GetClassPtr(obj))); }