ObjCRuntime Namespace
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The ObjCRuntime namespace provides classes and attributes for binding Objective-C types to .NET.
Classes
| Name | Description |
|---|---|
| AdoptsAttribute |
An attribute used to specify that a class adopts a specific Objective-C protocol. |
| AssemblyRegistrationEventArgs | |
| BaseWrapper |
Base class used by the bindinge generator to generate Protocol Wrapper Types. |
| BindAsAttribute |
The BindAsAttribute allows binding native NSNumber, NSValue and NSString (for enums) types into more accurate managed types. |
| BindingImplAttribute |
This attribute provides information about binding code. |
| BlockCallbackAttribute |
This attribute is applied to delegate parameters in a delegate to specify that the delegate parameter needs an Objective-C Block-style bridge. |
| BlockProxyAttribute |
This attribute is used to notify the runtime which class is used to wrap Objective-C blocks into managed delegates. |
| CategoryAttribute |
Attribute used to flag a class as a category that extends the API of another type. |
| CCallbackAttribute |
This attribute is applied to delegate parameters in a delegate to specify that the delegate parameter needs an C-style bridge. |
| Class |
Managed representation for an Objective-C class. |
| Constants |
Global constants to system libraries. |
| DelayedRegistrationAttribute | |
| DelegateProxyAttribute |
This attribute is used to notify the runtime which class is used to wrap managed delegates into Objective-C blocks. |
| DesignatedInitializerAttribute |
This attribute is used to mark managed constructors that bind Objective-C initializers marked with the NS_DESIGNATED_INITIALIZER attribute. |
| DisposableObject | |
| Dlfcn |
Provides access to the dynamic linker |
| LinkWithAttribute |
A LinkWith attribute specifies how the native library associated with the assembly should be linked to the resulting application. |
| MarshalManagedExceptionEventArgs |
The event args for the MarshalManagedException event. |
| MarshalObjectiveCExceptionEventArgs |
The event args for the MarshalObjectiveCException event. |
| MonoNativeFunctionWrapperAttribute |
Attribute to apply to delegates to flag them as targets that can be used with GetDelegateForFunctionPointer(IntPtr, Type). |
| MonoPInvokeCallbackAttribute |
Attribute used to annotate functions that will be called back from the unmanaged world. |
| NativeAttribute |
This attributes tells the Xamarin.iOS runtime that the native enum this managed enum binds is using a native size for the platform as the size for each enum value (i.e. a 32-bit value on 32-bit architectures, and a 64-bit value on 64-bit architectures). |
| NativeNameAttribute | |
| NativeObjectExtensions | |
| NMath | |
| ObjCException | |
| Protocol |
Representation of an Objective-C protocol. |
| ReleaseAttribute |
This attribute indicates that the return value of a function is retained (the caller obtains a reference to the object returned). |
| RequiredFrameworkAttribute | |
| RequiresSuperAttribute |
This attribute is applied to methods that must call their base implementation when they're overridden. |
| Runtime |
Provides information about the Xamarin.iOS Runtime. |
| Runtime.ClassHandles | |
| RuntimeException |
Class that represents an exception that occurs in the Xamarin runtime. |
| Selector |
Represents an Objective-C selector in managed code. |
| ThreadSafeAttribute |
A Attribute that indicates that a UIKit (for iOS) or AppKit (for macOS) method or class is thread-safe. |
| ThrowHelper | |
| TrampolineBlockBase | |
| TransientAttribute |
Flags a paramter in an NSObject subclass as being transient. |
| TypeConverter |
Converts Obj-C type encodings to managed types. |
| UserDelegateTypeAttribute |
This attribute is used on delegates created by the binding generator to properly map between signatures for Objective-C blocks and their corresponding exposed managed delegates. When binding Objective-C blocks, the binding generator will create a managed delegate whose signature is equivalent to the corresponding block's signature for the required binding code. However, this signature isn't necessarily accurate enough to re-create the block's signature at runtime (which is needed in some circumstances). This attribute makes it possible to find the type of the corresponding managed delegate that is exposed by the generated bindings, which does have enough information to re-create the corresponding block's signature. |
Structs
| Name | Description |
|---|---|
| BlockLiteral |
Wraps a ECMA CLI delegate (C# lambdas, anonymous methods or delegates) as an Objective-C block. |
| NativeHandle | |
Interfaces
| Name | Description |
|---|---|
| INativeObject |
A simple interface that is used to expose the unmanaged object pointer in various classes in Xamarin.iOS. |
Enums
| Name | Description |
|---|---|
| Arch |
Used to represent the host on which this app is running. |
| ArgumentSemantic |
Represents the assignment semantics for properties. |
| BindingImplOptions |
This enum is used by the BindingImplAttribute type to provide information about binding code. |
| Dlfcn.Mode | |
| Dlfcn.RTLD |
Dynamic loader resolution flags. |
| DlsymOption |
Used to specify if a library requires using dlsym to resolve P/Invokes to native functions. |
| LinkTarget |
Link targets available for LinkWithAttribute |
| MarshalManagedExceptionMode |
This enum is used to specify what to do when an managed exception is thrown, and that exception reaches native code. |
| MarshalObjectiveCExceptionMode |
This enum is used to specify what to do when an Objective-C exception is thrown, and that exception reaches managed code. |
Delegates
| Name | Description |
|---|---|
| AssemblyRegistrationHandler | |
| MarshalManagedExceptionHandler |
The event delegate for the MarshalManagedException event. |
| MarshalObjectiveCExceptionHandler |
The event delegate for the MarshalObjectiveCException event. |
Remarks
The ObjCRuntime namespace contains the fundamental types and attributes used to create bindings between Objective-C libraries and .NET code. It provides the runtime infrastructure that enables interoperability between managed .NET code and native Objective-C code on Apple platforms.
Key components of this namespace include:
- Binding attributes such as BindAsAttribute, CategoryAttribute, and DesignatedInitializerAttribute that control how .NET types map to Objective-C types. :
- Runtime support classes like Class and Selector that provide low-level access to the Objective-C runtime. :
- Block interoperability types such as BlockLiteral that enable working with Objective-C blocks from .NET. :
This namespace is primarily used by library authors creating bindings to Objective-C frameworks, though application developers may occasionally need to use some of its members for advanced interoperability scenarios.