Class Marshalling
public static class Marshalling
- Inheritance
-
Marshalling
- Inherited Members
Methods
Delete(nint)
public static void Delete(nint id)
Parameters
idnint
Get<T>(nint)
Used to get the C# instance responsible for an Objective-C instance.
public static T Get<T>(nint objCInstance)
Parameters
objCInstancenint
Returns
- T
Type Parameters
T
ObjCToCSharpNullable<T>(nint)
public static T? ObjCToCSharpNullable<T>(nint objCInstance) where T : class
Parameters
objCInstancenint
Returns
- T
Type Parameters
T
ObjCToCSharp<T>(nint)
public static T ObjCToCSharp<T>(nint objCInstance)
Parameters
objCInstancenint
Returns
- T
Type Parameters
T
Set(nint, object)
public static void Set(nint objCInstance, object cSharpInstance)
Parameters
SetClassWrapper(nint, Func<nint, object>)
Registers a class wrapper for Objective-C instances. It is recommended you construct the complete object graph in C#, and have C# instances responsible for the Objecitve-C counterparts, with complete ownership including lifespan.
In some cases, like dealing with singletons however, you will get Objective-C instances constructed by the runtime, and the method here will allow registering factories.
However wrapped instances will often retain the native one, and you will need to device an per-case plan how to deal with the lifetime of these.
public static void SetClassWrapper(nint objCClass, Func<nint, object> factory)