objectivec

package
v0.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package objectivec provides Go bindings for the ObjectiveC framework.

Gain low-level access to the Objective-C runtime and the Objective-C root types.

The [Objective-C Runtime](<doc://com.apple.objectivec/documentation/ObjectiveC>) module APIs define the base of the Objective-C language. These APIs include:

Classes

  • NSObject: The root class of most Objective-C class hierarchies, from which subclasses inherit a basic interface to the runtime system and the ability to behave as Objective-C objects.
  • Protocol

Protocols

  • NSObjectProtocol: The group of methods that are fundamental to all Objective-C objects.

Key Types

Code generated from Apple documentation. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClassSliceToNSArray

func ClassSliceToNSArray(slice []objc.Class) objc.ID

ClassSliceToNSArray converts a slice of objc.Class to an NSArray.

func Class_addIvar

func Class_addIvar(cls objc.Class, name string, size uintptr, alignment uint8, types string) bool

Class_addIvar adds a new instance variable to a class.

See: https://developer.apple.com/documentation/ObjectiveC/class_addIvar(_:_:_:_:_:)

func Class_addMethod

func Class_addMethod(cls objc.Class, name SEL, imp IMP, types string) bool

Class_addMethod adds a new method to a class with a given name and implementation.

See: https://developer.apple.com/documentation/ObjectiveC/class_addMethod(_:_:_:_:)

func Class_addProperty

func Class_addProperty(cls objc.Class, name string, attributes *Objc_property_attribute_t, attributeCount uint) bool

Class_addProperty adds a property to a class.

See: https://developer.apple.com/documentation/ObjectiveC/class_addProperty(_:_:_:_:)

func Class_addProtocol

func Class_addProtocol(cls objc.Class, protocol_ **Protocol) bool

Class_addProtocol adds a protocol to a class.

See: https://developer.apple.com/documentation/ObjectiveC/class_addProtocol(_:_:)

func Class_conformsToProtocol

func Class_conformsToProtocol(cls objc.Class, protocol_ **Protocol) bool

Class_conformsToProtocol returns a Boolean value that indicates whether a class conforms to a given protocol.

See: https://developer.apple.com/documentation/ObjectiveC/class_conformsToProtocol(_:_:)

func Class_getImageName

func Class_getImageName(cls objc.Class) *byte

Class_getImageName returns the name of the dynamic library a class originated from.

See: https://developer.apple.com/documentation/ObjectiveC/class_getImageName(_:)

func Class_getInstanceSize

func Class_getInstanceSize(cls objc.Class) uintptr

Class_getInstanceSize returns the size of instances of a class.

See: https://developer.apple.com/documentation/ObjectiveC/class_getInstanceSize(_:)

func Class_getIvarLayout

func Class_getIvarLayout(cls objc.Class) *uint8

Class_getIvarLayout returns a description of the Ivar layout for a given class.

See: https://developer.apple.com/documentation/ObjectiveC/class_getIvarLayout(_:)

func Class_getName

func Class_getName(cls objc.Class) *byte

Class_getName returns the name of a class.

See: https://developer.apple.com/documentation/ObjectiveC/class_getName(_:)

func Class_getProperty

func Class_getProperty(cls objc.Class, name string) unsafe.Pointer

Class_getProperty returns a property with a given name of a given class.

See: https://developer.apple.com/documentation/ObjectiveC/class_getProperty(_:_:)

func Class_getSuperclass

func Class_getSuperclass(cls objc.Class) objc.Class

Class_getSuperclass returns the superclass of a class.

See: https://developer.apple.com/documentation/ObjectiveC/class_getSuperclass(_:)

func Class_getVersion

func Class_getVersion(cls objc.Class) int

Class_getVersion returns the version number of a class definition.

See: https://developer.apple.com/documentation/ObjectiveC/class_getVersion(_:)

func Class_getWeakIvarLayout

func Class_getWeakIvarLayout(cls objc.Class) *uint8

Class_getWeakIvarLayout returns a description of the layout of weak [Ivar]s for a given class.

See: https://developer.apple.com/documentation/ObjectiveC/class_getWeakIvarLayout(_:)

func Class_isMetaClass

func Class_isMetaClass(cls objc.Class) bool

Class_isMetaClass returns a Boolean value that indicates whether a class object is a metaclass.

See: https://developer.apple.com/documentation/ObjectiveC/class_isMetaClass(_:)

func Class_replaceProperty

func Class_replaceProperty(cls objc.Class, name string, attributes *Objc_property_attribute_t, attributeCount uint)

Class_replaceProperty replace a property of a class.

See: https://developer.apple.com/documentation/ObjectiveC/class_replaceProperty(_:_:_:_:)

func Class_respondsToSelector

func Class_respondsToSelector(cls objc.Class, sel SEL) bool

Class_respondsToSelector returns a Boolean value that indicates whether instances of a class respond to a particular selector.

See: https://developer.apple.com/documentation/ObjectiveC/class_respondsToSelector(_:_:)

func Class_setIvarLayout

func Class_setIvarLayout(cls objc.Class, layout *uint8)

Class_setIvarLayout sets the Ivar layout for a given class.

See: https://developer.apple.com/documentation/ObjectiveC/class_setIvarLayout(_:_:)

func Class_setVersion

func Class_setVersion(cls objc.Class, version int)

Class_setVersion sets the version number of a class definition.

See: https://developer.apple.com/documentation/ObjectiveC/class_setVersion(_:_:)

func Class_setWeakIvarLayout

func Class_setWeakIvarLayout(cls objc.Class, layout *uint8)

Class_setWeakIvarLayout sets the layout for weak [Ivar]s for a given class.

See: https://developer.apple.com/documentation/ObjectiveC/class_setWeakIvarLayout(_:_:)

func IDSliceToNSArray

func IDSliceToNSArray(slice []objc.ID) objc.ID

IDSliceToNSArray converts a slice of objc.ID to an NSArray.

func IObjectSliceToNSArray

func IObjectSliceToNSArray[T IObject](slice []T) objc.ID

IObjectSliceToNSArray converts a slice of IObject-implementing types to an NSArray.

func Imp_removeBlock

func Imp_removeBlock(anImp IMP) bool

Imp_removeBlock disassociates a block from an IMP that was created using imp_implementationWithBlock(_:), and releases the copy of the block that was created.

See: https://developer.apple.com/documentation/ObjectiveC/imp_removeBlock(_:)

func Ivar_getName

func Ivar_getName(v Ivar) *byte

Ivar_getName returns the name of an instance variable.

See: https://developer.apple.com/documentation/ObjectiveC/ivar_getName(_:)

func Ivar_getOffset

func Ivar_getOffset(v Ivar) int

Ivar_getOffset returns the offset of an instance variable.

See: https://developer.apple.com/documentation/ObjectiveC/ivar_getOffset(_:)

func Ivar_getTypeEncoding

func Ivar_getTypeEncoding(v Ivar) *byte

Ivar_getTypeEncoding returns the type string of an instance variable.

See: https://developer.apple.com/documentation/ObjectiveC/ivar_getTypeEncoding(_:)

func Method_copyArgumentType

func Method_copyArgumentType(m Method, index uint) *byte

Method_copyArgumentType returns a string describing a single parameter type of a method.

See: https://developer.apple.com/documentation/ObjectiveC/method_copyArgumentType(_:_:)

func Method_copyReturnType

func Method_copyReturnType(m Method) *byte

Method_copyReturnType returns a string describing a method’s return type.

See: https://developer.apple.com/documentation/ObjectiveC/method_copyReturnType(_:)

func Method_exchangeImplementations

func Method_exchangeImplementations(m1 Method, m2 Method)

Method_exchangeImplementations exchanges the implementations of two methods.

See: https://developer.apple.com/documentation/ObjectiveC/method_exchangeImplementations(_:_:)

func Method_getArgumentType

func Method_getArgumentType(m Method, index uint, dst *byte, dst_len uintptr)

Method_getArgumentType returns by reference a string describing a single parameter type of a method.

See: https://developer.apple.com/documentation/ObjectiveC/method_getArgumentType(_:_:_:_:)

func Method_getNumberOfArguments

func Method_getNumberOfArguments(m Method) uint

Method_getNumberOfArguments returns the number of arguments accepted by a method.

See: https://developer.apple.com/documentation/ObjectiveC/method_getNumberOfArguments(_:)

func Method_getReturnType

func Method_getReturnType(m Method, dst *byte, dst_len uintptr)

Method_getReturnType returns by reference a string describing a method’s return type.

See: https://developer.apple.com/documentation/ObjectiveC/method_getReturnType(_:_:_:)

func Method_getTypeEncoding

func Method_getTypeEncoding(m Method) *byte

Method_getTypeEncoding returns a string describing a method’s parameter and return types.

See: https://developer.apple.com/documentation/ObjectiveC/method_getTypeEncoding(_:)

func Method_invoke

func Method_invoke()

Method_invoke calls the implementation of a specified method.

See: https://developer.apple.com/documentation/ObjectiveC/method_invoke

func NXCompareHashTables deprecated

func NXCompareHashTables(table1 *NXHashTable, table2 *NXHashTable) bool

NXCompareHashTables.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXCompareHashTables

func NXCountHashTable deprecated

func NXCountHashTable(table *NXHashTable) uint

NXCountHashTable.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXCountHashTable

func NXEmptyHashTable deprecated

func NXEmptyHashTable(table *NXHashTable)

NXEmptyHashTable.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXEmptyHashTable

func NXFreeHashTable deprecated

func NXFreeHashTable(table *NXHashTable)

NXFreeHashTable.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXFreeHashTable

func NXHashGet deprecated

func NXHashGet(table *NXHashTable, data unsafe.Pointer) unsafe.Pointer

NXHashGet.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXHashGet

func NXHashInsert deprecated

func NXHashInsert(table *NXHashTable, data unsafe.Pointer) unsafe.Pointer

NXHashInsert.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXHashInsert

func NXHashInsertIfAbsent deprecated

func NXHashInsertIfAbsent(table *NXHashTable, data unsafe.Pointer) unsafe.Pointer

NXHashInsertIfAbsent.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXHashInsertIfAbsent

func NXHashMember deprecated

func NXHashMember(table *NXHashTable, data unsafe.Pointer) int

NXHashMember.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXHashMember

func NXHashRemove deprecated

func NXHashRemove(table *NXHashTable, data unsafe.Pointer) unsafe.Pointer

NXHashRemove.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXHashRemove

func NXNextHashState deprecated

func NXNextHashState(table *NXHashTable, state *NXHashState, data unsafe.Pointer) int

NXNextHashState.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXNextHashState

func NXNoEffectFree deprecated

func NXNoEffectFree(info unsafe.Pointer, data unsafe.Pointer)

NXNoEffectFree.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXNoEffectFree

func NXPtrHash deprecated

func NXPtrHash(info unsafe.Pointer, data unsafe.Pointer) uintptr

NXPtrHash.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXPtrHash

func NXPtrIsEqual deprecated

func NXPtrIsEqual(info unsafe.Pointer, data1 unsafe.Pointer, data2 unsafe.Pointer) int

NXPtrIsEqual.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXPtrIsEqual

func NXReallyFree deprecated

func NXReallyFree(info unsafe.Pointer, data unsafe.Pointer)

NXReallyFree.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXReallyFree

func NXResetHashTable deprecated

func NXResetHashTable(table *NXHashTable)

NXResetHashTable.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXResetHashTable

func NXStrHash deprecated

func NXStrHash(info unsafe.Pointer, data unsafe.Pointer) uintptr

NXStrHash.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXStrHash

func NXStrIsEqual deprecated

func NXStrIsEqual(info unsafe.Pointer, data1 unsafe.Pointer, data2 unsafe.Pointer) int

NXStrIsEqual.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXStrIsEqual

func Objc_allocateClassPair

func Objc_allocateClassPair(superclass objc.Class, name string, extraBytes uintptr) objc.Class

Objc_allocateClassPair creates a new class and metaclass.

See: https://developer.apple.com/documentation/ObjectiveC/objc_allocateClassPair(_:_:_:)

func Objc_copyClassList

func Objc_copyClassList(outCount *uint) objc.Class

Objc_copyClassList creates and returns a list of pointers to all registered class definitions.

See: https://developer.apple.com/documentation/ObjectiveC/objc_copyClassList(_:)

func Objc_copyClassNamesForImage

func Objc_copyClassNamesForImage(image string, outCount *uint) *byte

Objc_copyClassNamesForImage returns the names of all the classes within a specified library or framework.

See: https://developer.apple.com/documentation/ObjectiveC/objc_copyClassNamesForImage(_:_:)

func Objc_copyImageNames

func Objc_copyImageNames(outCount *uint) *byte

Objc_copyImageNames returns the names of all the loaded Objective-C frameworks and dynamic libraries.

See: https://developer.apple.com/documentation/ObjectiveC/objc_copyImageNames(_:)

func Objc_destructInstance

func Objc_destructInstance(obj Object) unsafe.Pointer

Objc_destructInstance destroys an instance of a class without freeing memory and removes any of its associated references.

See: https://developer.apple.com/documentation/ObjectiveC/objc_destructInstance

func Objc_disposeClassPair

func Objc_disposeClassPair(cls objc.Class)

Objc_disposeClassPair destroys a class and its associated metaclass.

See: https://developer.apple.com/documentation/ObjectiveC/objc_disposeClassPair(_:)

func Objc_duplicateClass

func Objc_duplicateClass(original objc.Class, name string, extraBytes uintptr) objc.Class

Objc_duplicateClass used by Foundation’s Key-Value Observing.

See: https://developer.apple.com/documentation/ObjectiveC/objc_duplicateClass(_:_:_:)

func Objc_enumerateClasses

func Objc_enumerateClasses(image unsafe.Pointer, namePrefix string, conformingTo **Protocol, subclassing objc.Class)

Objc_enumerateClasses.

See: https://developer.apple.com/documentation/ObjectiveC/objc_enumerateClasses

func Objc_enumerationMutation

func Objc_enumerationMutation(obj Object)

Objc_enumerationMutation inserted by the compiler when a mutation is detected during a foreach iteration.

See: https://developer.apple.com/documentation/ObjectiveC/objc_enumerationMutation(_:)

func Objc_exception_rethrow

func Objc_exception_rethrow()

Objc_exception_rethrow.

See: https://developer.apple.com/documentation/ObjectiveC/objc_exception_rethrow()

func Objc_exception_throw

func Objc_exception_throw(exception Object)

Objc_exception_throw throw a runtime exception.

See: https://developer.apple.com/documentation/ObjectiveC/objc_exception_throw(_:)

func Objc_getClassList

func Objc_getClassList(buffer objc.Class, bufferCount int) int

Objc_getClassList obtains the list of registered class definitions.

See: https://developer.apple.com/documentation/ObjectiveC/objc_getClassList(_:_:)

func Objc_getFutureClass

func Objc_getFutureClass(name string) objc.Class

Objc_getFutureClass used by CoreFoundation’s toll-free bridging.

See: https://developer.apple.com/documentation/ObjectiveC/objc_getFutureClass

func Objc_getRequiredClass

func Objc_getRequiredClass(name string) objc.Class

Objc_getRequiredClass returns the class definition of a specified class.

See: https://developer.apple.com/documentation/ObjectiveC/objc_getRequiredClass(_:)

func Objc_lookUpClass

func Objc_lookUpClass(name string) objc.Class

Objc_lookUpClass returns the class definition of a specified class.

See: https://developer.apple.com/documentation/ObjectiveC/objc_lookUpClass(_:)

func Objc_msgSend

func Objc_msgSend()

Objc_msgSend sends a message with a simple return value to an instance of a class.

See: https://developer.apple.com/documentation/ObjectiveC/objc_msgSend

func Objc_msgSendSuper

func Objc_msgSendSuper()

Objc_msgSendSuper sends a message with a simple return value to the superclass of an instance of a class.

See: https://developer.apple.com/documentation/ObjectiveC/objc_msgSendSuper

func Objc_registerClassPair

func Objc_registerClassPair(cls objc.Class)

Objc_registerClassPair registers a class that was allocated using objc_allocateClassPair(_:_:_:).

See: https://developer.apple.com/documentation/ObjectiveC/objc_registerClassPair(_:)

func Objc_registerProtocol

func Objc_registerProtocol(proto **Protocol)

Objc_registerProtocol registers a newly created protocol with the Objective-C runtime.

See: https://developer.apple.com/documentation/ObjectiveC/objc_registerProtocol(_:)

func Objc_removeAssociatedObjects

func Objc_removeAssociatedObjects(object Object)

Objc_removeAssociatedObjects removes all associations for a given object.

See: https://developer.apple.com/documentation/ObjectiveC/objc_removeAssociatedObjects(_:)

func Objc_removeExceptionHandler

func Objc_removeExceptionHandler(token uintptr)

Objc_removeExceptionHandler.

See: https://developer.apple.com/documentation/ObjectiveC/objc_removeExceptionHandler(_:)

func Objc_setAssociatedObject added in v0.2.0

func Objc_setAssociatedObject(object Object, key unsafe.Pointer, value Object, policy uintptr)

Objc_setAssociatedObject sets an associated value for a given object using a given key and association policy.

See: https://developer.apple.com/documentation/ObjectiveC/objc_setAssociatedObject(_:_:_:_:)

func Objc_setEnumerationMutationHandler

func Objc_setEnumerationMutationHandler(handler func(Object))

Objc_setEnumerationMutationHandler sets the current mutation handler.

See: https://developer.apple.com/documentation/ObjectiveC/objc_setEnumerationMutationHandler(_:)

func Objc_setForwardHandler

func Objc_setForwardHandler(fwd unsafe.Pointer, fwd_stret unsafe.Pointer)

Objc_setForwardHandler set the function to be called by objc_msgForward.

See: https://developer.apple.com/documentation/ObjectiveC/objc_setForwardHandler(_:_:)

func Objc_setHook_getClass

func Objc_setHook_getClass(newValue unsafe.Pointer, outOldValue *Objc_hook_getClass)

Objc_setHook_getClass.

See: https://developer.apple.com/documentation/ObjectiveC/objc_setHook_getClass(_:_:)

func Objc_setHook_getImageName

func Objc_setHook_getImageName(newValue unsafe.Pointer, outOldValue *Objc_hook_getImageName)

Objc_setHook_getImageName.

See: https://developer.apple.com/documentation/ObjectiveC/objc_setHook_getImageName(_:_:)

func Objc_setHook_lazyClassNamer

func Objc_setHook_lazyClassNamer(newValue unsafe.Pointer, oldOutValue *Objc_hook_lazyClassNamer)

Objc_setHook_lazyClassNamer.

See: https://developer.apple.com/documentation/ObjectiveC/objc_setHook_lazyClassNamer(_:_:)

func Objc_sync_enter

func Objc_sync_enter(obj Object) int

Objc_sync_enter begin synchronizing on ‘obj’.

See: https://developer.apple.com/documentation/ObjectiveC/objc_sync_enter

func Objc_sync_exit

func Objc_sync_exit(obj Object) int

Objc_sync_exit end synchronizing on ‘obj’.

See: https://developer.apple.com/documentation/ObjectiveC/objc_sync_exit

func Object_getClass

func Object_getClass(obj Object) objc.Class

Object_getClass returns the class of an object.

See: https://developer.apple.com/documentation/ObjectiveC/object_getClass(_:)

func Object_getClassName

func Object_getClassName(obj Object) *byte

Object_getClassName returns the class name of a given object.

See: https://developer.apple.com/documentation/ObjectiveC/object_getClassName(_:)

func Object_getIndexedIvars

func Object_getIndexedIvars(obj Object) unsafe.Pointer

Object_getIndexedIvars returns a pointer to any extra bytes allocated with a instance given object.

See: https://developer.apple.com/documentation/ObjectiveC/object_getIndexedIvars(_:)

func Object_setClass

func Object_setClass(obj Object, cls objc.Class) objc.Class

Object_setClass sets the class of an object.

See: https://developer.apple.com/documentation/ObjectiveC/object_setClass(_:_:)

func Object_setIvar

func Object_setIvar(obj Object, ivar Ivar, value Object)

Object_setIvar sets the value of an instance variable in an object.

See: https://developer.apple.com/documentation/ObjectiveC/object_setIvar(_:_:_:)

func Object_setIvarWithStrongDefault

func Object_setIvarWithStrongDefault(obj Object, ivar Ivar, value Object)

Object_setIvarWithStrongDefault.

See: https://developer.apple.com/documentation/ObjectiveC/object_setIvarWithStrongDefault(_:_:_:)

func Property_copyAttributeValue

func Property_copyAttributeValue(property unsafe.Pointer, attributeName string) *byte

Property_copyAttributeValue returns the value of a property attribute given the attribute name.

See: https://developer.apple.com/documentation/ObjectiveC/property_copyAttributeValue(_:_:)

func Property_getAttributes

func Property_getAttributes(property unsafe.Pointer) *byte

Property_getAttributes returns the attribute string of a property.

See: https://developer.apple.com/documentation/ObjectiveC/property_getAttributes(_:)

func Property_getName

func Property_getName(property unsafe.Pointer) *byte

Property_getName returns the name of a property.

See: https://developer.apple.com/documentation/ObjectiveC/property_getName(_:)

func Protocol_addMethodDescription

func Protocol_addMethodDescription(proto **Protocol, name SEL, types string, isRequiredMethod bool, isInstanceMethod bool)

Protocol_addMethodDescription adds a method to a protocol.

See: https://developer.apple.com/documentation/ObjectiveC/protocol_addMethodDescription(_:_:_:_:_:)

func Protocol_addProperty

func Protocol_addProperty(proto **Protocol, name string, attributes *Objc_property_attribute_t, attributeCount uint, isRequiredProperty bool, isInstanceProperty bool)

Protocol_addProperty adds a property to a protocol that is under construction.

See: https://developer.apple.com/documentation/ObjectiveC/protocol_addProperty(_:_:_:_:_:_:)

func Protocol_addProtocol

func Protocol_addProtocol(proto **Protocol, addition **Protocol)

Protocol_addProtocol adds a registered protocol to another protocol that is under construction.

See: https://developer.apple.com/documentation/ObjectiveC/protocol_addProtocol(_:_:)

func Protocol_conformsToProtocol

func Protocol_conformsToProtocol(proto **Protocol, other **Protocol) bool

Protocol_conformsToProtocol returns a Boolean value that indicates whether one protocol conforms to another protocol.

See: https://developer.apple.com/documentation/ObjectiveC/protocol_conformsToProtocol(_:_:)

func Protocol_getMethodDescription

func Protocol_getMethodDescription(proto **Protocol, aSel SEL, isRequiredMethod bool, isInstanceMethod bool) unsafe.Pointer

Protocol_getMethodDescription returns a method description structure for a specified method of a given protocol.

See: https://developer.apple.com/documentation/ObjectiveC/protocol_getMethodDescription(_:_:_:_:)

func Protocol_getName

func Protocol_getName(proto **Protocol) *byte

Protocol_getName returns the name of a protocol.

See: https://developer.apple.com/documentation/ObjectiveC/protocol_getName(_:)

func Protocol_getProperty

func Protocol_getProperty(proto **Protocol, name string, isRequiredProperty bool, isInstanceProperty bool) unsafe.Pointer

Protocol_getProperty returns the specified property of a given protocol.

See: https://developer.apple.com/documentation/ObjectiveC/protocol_getProperty(_:_:_:_:)

func Protocol_isEqual

func Protocol_isEqual(proto **Protocol, other **Protocol) bool

Protocol_isEqual returns a Boolean value that indicates whether two protocols are equal.

See: https://developer.apple.com/documentation/ObjectiveC/protocol_isEqual(_:_:)

func Sel_getName

func Sel_getName(sel SEL) *byte

Sel_getName returns the name of the method specified by a given selector.

See: https://developer.apple.com/documentation/ObjectiveC/sel_getName(_:)

func Sel_isEqual

func Sel_isEqual(lhs SEL, rhs SEL) bool

Sel_isEqual returns a Boolean value that indicates whether two selectors are equal.

See: https://developer.apple.com/documentation/ObjectiveC/sel_isEqual(_:_:)

func Sel_isMapped

func Sel_isMapped(sel SEL) bool

Sel_isMapped identifies a selector as being valid or invalid.

See: https://developer.apple.com/documentation/ObjectiveC/sel_isMapped(_:)

func SliceToNSArray

func SliceToNSArray[T any](slice []T, toID func(T) objc.ID) objc.ID

SliceToNSArray converts a Go slice to an NSArray. The toID function extracts the objc.ID from each element. Returns an empty NSArray if the slice is empty. Note: The returned NSArray is autoreleased. If you need to keep it beyond the current autorelease pool scope, call Retain() on the result.

func StringSliceToNSArray

func StringSliceToNSArray(slice []string) objc.ID

StringSliceToNSArray converts a Go []string to an NSArray of NSString objects.

Types

type BOOL

type BOOL = bool

BOOL is type to represent a Boolean value.

See: https://developer.apple.com/documentation/ObjectiveC/BOOL

type Category

type Category = uintptr

Category is an opaque type that represents a category.

See: https://developer.apple.com/documentation/ObjectiveC/Category

type Class

type Class = objc.Class

Class is an opaque type that represents an Objective-C class.

See: https://developer.apple.com/documentation/ObjectiveC/Class

type IMP

type IMP = func()

IMP is a pointer to the start of a method implementation.

See: https://developer.apple.com/documentation/ObjectiveC/IMP

func Class_getMethodImplementation

func Class_getMethodImplementation(cls objc.Class, name SEL) IMP

Class_getMethodImplementation returns the function pointer that would be called if a particular message were sent to an instance of a class.

See: https://developer.apple.com/documentation/ObjectiveC/class_getMethodImplementation(_:_:)

func Class_replaceMethod

func Class_replaceMethod(cls objc.Class, name SEL, imp IMP, types string) IMP

Class_replaceMethod replaces the implementation of a method for a given class.

See: https://developer.apple.com/documentation/ObjectiveC/class_replaceMethod(_:_:_:_:)

func Imp_implementationWithBlock

func Imp_implementationWithBlock(block Object) IMP

Imp_implementationWithBlock creates a pointer to a function that calls the specified block when the method is called.

See: https://developer.apple.com/documentation/ObjectiveC/imp_implementationWithBlock(_:)

func Method_getImplementation

func Method_getImplementation(m Method) IMP

Method_getImplementation returns the implementation of a method.

See: https://developer.apple.com/documentation/ObjectiveC/method_getImplementation(_:)

func Method_setImplementation

func Method_setImplementation(m Method, imp IMP) IMP

Method_setImplementation sets the implementation of a method.

See: https://developer.apple.com/documentation/ObjectiveC/method_setImplementation(_:_:)

type IObject

type IObject interface {
	GetID() objc.ID
}

IObject is the interface implemented by all Objective-C object wrappers.

type IProtocol

type IProtocol interface {
	IObject
}

An interface definition for the Protocol class.

See: https://developer.apple.com/documentation/ObjectiveC/Protocol

type Id

type Id = Object

Id is a pointer to an instance of a class.

See: https://developer.apple.com/documentation/ObjectiveC/id

type Ivar

type Ivar = uintptr

Ivar is an opaque type that represents an instance variable.

See: https://developer.apple.com/documentation/ObjectiveC/Ivar

func Class_copyIvarList

func Class_copyIvarList(cls objc.Class, outCount *uint) Ivar

Class_copyIvarList describes the instance variables declared by a class.

See: https://developer.apple.com/documentation/ObjectiveC/class_copyIvarList(_:_:)

func Class_getClassVariable

func Class_getClassVariable(cls objc.Class, name string) Ivar

Class_getClassVariable returns the Ivar for a specified class variable of a given class.

See: https://developer.apple.com/documentation/ObjectiveC/class_getClassVariable(_:_:)

func Class_getInstanceVariable

func Class_getInstanceVariable(cls objc.Class, name string) Ivar

Class_getInstanceVariable returns the Ivar for a specified instance variable of a given class.

See: https://developer.apple.com/documentation/ObjectiveC/class_getInstanceVariable(_:_:)

func Object_getInstanceVariable

func Object_getInstanceVariable(obj Object, name string, outValue unsafe.Pointer) Ivar

Object_getInstanceVariable obtains the value of an instance variable of a class instance.

See: https://developer.apple.com/documentation/ObjectiveC/object_getInstanceVariable

func Object_setInstanceVariable

func Object_setInstanceVariable(obj Object, name string, value unsafe.Pointer) Ivar

Object_setInstanceVariable changes the value of an instance variable of a class instance.

See: https://developer.apple.com/documentation/ObjectiveC/object_setInstanceVariable

func Object_setInstanceVariableWithStrongDefault

func Object_setInstanceVariableWithStrongDefault(obj Object, name string, value unsafe.Pointer) Ivar

Object_setInstanceVariableWithStrongDefault.

See: https://developer.apple.com/documentation/ObjectiveC/object_setInstanceVariableWithStrongDefault

type Method

type Method = uintptr

Method is an opaque type that represents a method in a class definition.

See: https://developer.apple.com/documentation/ObjectiveC/Method

func Class_copyMethodList

func Class_copyMethodList(cls objc.Class, outCount *uint) Method

Class_copyMethodList describes the instance methods implemented by a class.

See: https://developer.apple.com/documentation/ObjectiveC/class_copyMethodList(_:_:)

func Class_getClassMethod

func Class_getClassMethod(cls objc.Class, name SEL) Method

Class_getClassMethod returns a pointer to the data structure describing a given class method for a given class.

See: https://developer.apple.com/documentation/ObjectiveC/class_getClassMethod(_:_:)

func Class_getInstanceMethod

func Class_getInstanceMethod(cls objc.Class, name SEL) Method

Class_getInstanceMethod returns a specified instance method for a given class.

See: https://developer.apple.com/documentation/ObjectiveC/class_getInstanceMethod(_:_:)

type NSInteger

type NSInteger = int

NSInteger is describes an integer.

See: https://developer.apple.com/documentation/ObjectiveC/NSInteger

type NSObject

type NSObject interface {

	// Returns the class object for the receiver’s superclass.
	//
	// See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/superclass
	Superclass() objc.Class

	// Returns an integer that can be used as a table address in a hash table structure.
	//
	// See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/hash
	Hash() uint

	// Returns the receiver.
	//
	// See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/self()
	Self() IObject

	// Returns a Boolean value that indicates whether the receiver is an instance of given class or an instance of any class that inherits from that class.
	//
	// See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/isKind(of:)
	IsKindOfClass(aClass objc.Class) bool

	// Returns a Boolean value that indicates whether the receiver is an instance of a given class.
	//
	// See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/isMember(of:)
	IsMemberOfClass(aClass objc.Class) bool

	// Returns a Boolean value that indicates whether the receiver implements or inherits a method that can respond to a specified message.
	//
	// See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/responds(to:)
	RespondsToSelector(aSelector objc.SEL) bool

	// Returns a Boolean value that indicates whether the receiver conforms to a given protocol.
	//
	// See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/conforms(to:)
	ConformsToProtocol(aProtocol unsafe.Pointer) bool

	// A textual representation of the receiver.
	//
	// See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/description
	Description() IObject

	// A textual representation of the receiver to use with a debugger.
	//
	// See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/debugDescription
	DebugDescription() IObject

	// Returns a Boolean value that indicates whether the receiver does not descend from [NSObject](<doc://com.apple.objectivec/documentation/ObjectiveC/NSObject-swift.class>).
	//
	// See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/isProxy()
	IsProxy() bool

	// Decrements the receiver’s reference count.
	//
	// See: https://developer.apple.com/documentation/ObjectiveC/NSObject-c.protocol/release
	Release()

	// Increments the receiver’s reference count.
	//
	// See: https://developer.apple.com/documentation/ObjectiveC/NSObject-c.protocol/retain
	Retain() IObject
}

The group of methods that are fundamental to all Objective-C objects.

See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol

type NSObjectObject

type NSObjectObject struct {
	Object
}

NSObjectObject wraps an existing Objective-C object that conforms to the NSObject protocol.

func NSObjectObjectFromID

func NSObjectObjectFromID(id objc.ID) NSObjectObject

NSObjectObjectFromID constructs a NSObjectObject from an objc.ID. The object is determined to conform to the protocol at runtime.

func (NSObjectObject) BaseObject

func (o NSObjectObject) BaseObject() Object

func (NSObjectObject) ConformsToProtocol

func (o NSObjectObject) ConformsToProtocol(aProtocol unsafe.Pointer) bool

Returns a Boolean value that indicates whether the receiver conforms to a given protocol.

aProtocol: A protocol object that represents a particular protocol.

Return Value

YES if the receiver conforms to `aProtocol`, otherwise NO.

Discussion

This method works identically to the conforms(to:) class method declared in NSObject. It’s provided as a convenience so that you don’t need to get the class object to find out whether an instance can respond to a given set of messages.

See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/conforms(to:)

func (NSObjectObject) DebugDescription

func (o NSObjectObject) DebugDescription() IObject

A textual representation of the receiver to use with a debugger.

See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/debugDescription

func (NSObjectObject) Description

func (o NSObjectObject) Description() IObject

A textual representation of the receiver.

See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/description

func (NSObjectObject) Hash

func (o NSObjectObject) Hash() uint

Returns an integer that can be used as a table address in a hash table structure.

See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/hash

func (NSObjectObject) IsEqual

func (o NSObjectObject) IsEqual(object IObject) bool

Returns a Boolean value that indicates whether the receiver and a given object are equal.

object: The object to be compared to the receiver. May be `nil`, in which case this method returns NO. // NO: https://developer.apple.com/documentation/ObjectiveC/NO

Return Value

YES if the receiver and `anObject` are equal, otherwise NO.

Discussion

This method defines what it means for instances to be equal. For example, a container object might define two containers as equal if their corresponding objects all respond YES to an [IsEqual] request. See the NSData, NSDictionary, NSArray, and NSString class specifications for examples of the use of this method.

If two objects are equal, they must have the same hash value. This last point is particularly important if you define [IsEqual] in a subclass and intend to put instances of that subclass into a collection. Make sure you also define [Hash] in your subclass.

See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/isEqual(_:)

func (NSObjectObject) IsKindOfClass

func (o NSObjectObject) IsKindOfClass(aClass objc.Class) bool

Returns a Boolean value that indicates whether the receiver is an instance of given class or an instance of any class that inherits from that class.

aClass: A class object representing the Objective-C class to be tested.

Return Value

YES if the receiver is an instance of `aClass` or an instance of any class that inherits from `aClass`, otherwise NO.

Discussion

For example, in this code, [IsKindOfClass] would return YES because, in Foundation, the NSArchiver class inherits from NSCoder:

Be careful when using this method on objects represented by a class cluster. Because of the nature of class clusters, the object you get back may not always be the type you expected. If you call a method that returns a class cluster, the exact type returned by the method is the best indicator of what you can do with that object. For example, if a method returns a pointer to an NSArray object, you should not use this method to see if the array is mutable, as shown in the following code:

If you use such constructs in your code, you might think it is alright to modify an object that in reality should not be modified. Doing so might then create problems for other code that expected the object to remain unchanged.

If the receiver is a class object, this method returns YES if `aClass` is a Class object of the same type, NO otherwise.

See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/isKind(of:)

func (NSObjectObject) IsMemberOfClass

func (o NSObjectObject) IsMemberOfClass(aClass objc.Class) bool

Returns a Boolean value that indicates whether the receiver is an instance of a given class.

aClass: A class object representing the Objective-C class to be tested.

Return Value

YES if the receiver is an instance of `aClass`, otherwise NO.

Discussion

For example, in this code, [IsMemberOfClass] would return NO:

Class objects may be compiler-created objects but they still support the concept of membership. Thus, you can use this method to verify that the receiver is a specific Class object.

See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/isMember(of:)

func (NSObjectObject) IsProxy

func (o NSObjectObject) IsProxy() bool

Returns a Boolean value that indicates whether the receiver does not descend from NSObject.

Return Value

NO if the receiver really descends from NSObject, otherwise YES.

Discussion

This method is necessary because sending [IsKindOfClass] or [IsMemberOfClass] to an NSProxy object will test the object the proxy stands in for, not the proxy itself. Use this method to test if the receiver is a proxy (or a member of some other root class).

See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/isProxy()

func (NSObjectObject) PerformSelector

func (o NSObjectObject) PerformSelector(aSelector objc.SEL) IObject

Sends a specified message to the receiver and returns the result of the message.

aSelector: A selector identifying the message to send. The message should take no arguments. If `aSelector` is [NULL], an [invalidArgumentException] is raised. // [invalidArgumentException]: https://developer.apple.com/documentation/Foundation/NSExceptionName/invalidArgumentException

Return Value

An object that is the result of the message.

Discussion

Calling the [PerformSelector] method is equivalent to sending the `aSelector` message directly to the receiver. For example, the following both do the same thing if `anObject` is an instance of [MyObject]:

The [PerformSelector] method allows you to send messages that aren’t determined until run-time. This means that you can pass a variable selector as the argument:

Use caution when doing this. This method returns an implicitly unwrapped optional unmanaged pointer to an AnyObject instance (Unmanaged`!`). It’s up to you to decide how to bring the instance into Swift’s memory management scheme. Different messages require different memory management strategies for their returned objects, and it might not be obvious which to use.

Usually, a caller isn’t responsible for the memory of a returned instance, in which case you use takeUnretainedValue(), as shown above. However, for any of the creation methods, such as copy(), the caller is responsible, and you use takeRetainedValue() instead. See Memory Management Policy in Advanced Memory Management Programming Guide for a description of ownership expectations.

Due to this uncertainty, the compiler generates a warning if you supply a variable selector while using ARC to manage memory. Because it can’t determine ownership of the returned object at compile-time, ARC makes the assumption that the caller does need to take ownership, but this may not be true. The compiler warning alerts you to the potential for a memory leak.

To avoid the warning, if you know that `aSelector` has no return value, you might be able to use performSelector(onMainThread:with:waitUntilDone:) or one of the related methods available in NSObject.

For a more general solution, use NSInvocation to construct a message that you can invoke with an arbitrary argument list and return value.

Alternatively, consider restructuring your code to use blocks as a means of passing chunks of functionality through an API. See Blocks Programming Topics for details.

See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/perform(_:)

func (NSObjectObject) PerformSelectorWithObject

func (o NSObjectObject) PerformSelectorWithObject(aSelector objc.SEL, object IObject) IObject

Sends a message to the receiver with an object as the argument.

aSelector: A selector identifying the message to send. If `aSelector` is [NULL], an [invalidArgumentException] is raised. // [invalidArgumentException]: https://developer.apple.com/documentation/Foundation/NSExceptionName/invalidArgumentException

object: An object that is the sole argument of the message.

Return Value

An object that is the result of the message.

Discussion

This method is the same as [PerformSelector] except that you can supply an argument for `aSelector`. `aSelector` should identify a method that takes a single argument of type id. For methods with other argument types and return values, use NSInvocation.

See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/perform(_:with:)

func (NSObjectObject) PerformSelectorWithObjectWithObject

func (o NSObjectObject) PerformSelectorWithObjectWithObject(aSelector objc.SEL, object1 IObject, object2 IObject) IObject

Sends a message to the receiver with two objects as arguments.

aSelector: A selector identifying the message to send. If `aSelector` is [NULL], an [invalidArgumentException] is raised. // [invalidArgumentException]: https://developer.apple.com/documentation/Foundation/NSExceptionName/invalidArgumentException

object1: An object that is the first argument of the message.

object2: An object that is the second argument of the message

Return Value

An object that is the result of the message.

Discussion

This method is the same as [PerformSelector] except that you can supply two arguments for `aSelector`. `aSelector` should identify a method that can take two arguments of type id. For methods with other argument types and return values, use NSInvocation.

See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/perform(_:with:with:)

func (NSObjectObject) Release

func (o NSObjectObject) Release()

Decrements the receiver’s reference count.

Discussion

The receiver is sent a dealloc message when its reference count reaches `0`.

You would only implement this method to define your own reference-counting scheme. Such implementations should not invoke the inherited method; that is, they should not include a release message to `super`.

For more information on the reference counting mechanism, see Advanced Memory Management Programming Guide.

Special Considerations

Instead of using manual reference counting, you should adopt ARC—see Transitioning to ARC Release Notes.

See: https://developer.apple.com/documentation/ObjectiveC/NSObject-c.protocol/release

func (NSObjectObject) RespondsToSelector

func (o NSObjectObject) RespondsToSelector(aSelector objc.SEL) bool

Returns a Boolean value that indicates whether the receiver implements or inherits a method that can respond to a specified message.

aSelector: A selector that identifies a message.

Return Value

YES if the receiver implements or inherits a method that can respond to `aSelector`, otherwise NO.

Discussion

The application is responsible for determining whether a NO response should be considered an error.

You cannot test whether an object inherits a method from its superclass by sending [RespondsToSelector] to the object using the `super` keyword. This method will still be testing the object as a whole, not just the superclass’s implementation. Therefore, sending [RespondsToSelector] to `super` is equivalent to sending it to `self`. Instead, you must invoke the NSObject class method instancesRespond(to:) directly on the object’s superclass, as illustrated in the following code fragment.

You cannot simply use `[[self superclass] @selector(aMethod)]` since this may cause the method to fail if it is invoked by a subclass.

Note that if the receiver is able to forward `aSelector` messages to another object, it will be able to respond to the message, albeit indirectly, even though this method returns NO.

See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/responds(to:)

func (NSObjectObject) Retain

func (o NSObjectObject) Retain() IObject

Increments the receiver’s reference count.

Return Value

`self`.

Discussion

You send an object a [Retain] message when you want to prevent it from being deallocated until you have finished using it.

An object is deallocated automatically when its reference count reaches `0`. [Retain] messages increment the reference count, and [Release] messages decrement it. For more information on this mechanism, see Advanced Memory Management Programming Guide.

As a convenience, [Retain] returns `self` because it may be used in nested expressions.

You would implement this method only if you were defining your own reference-counting scheme. Such implementations must return `self` and should not invoke the inherited method by sending a [Retain] message to `super`.

Special Considerations

Instead of using manual reference counting, you should adopt ARC—see Transitioning to ARC Release Notes.

See: https://developer.apple.com/documentation/ObjectiveC/NSObject-c.protocol/retain

func (NSObjectObject) Self

func (o NSObjectObject) Self() IObject

Returns the receiver.

Return Value

The receiver.

See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/self()

func (NSObjectObject) Superclass

func (o NSObjectObject) Superclass() objc.Class

Returns the class object for the receiver’s superclass.

See: https://developer.apple.com/documentation/ObjectiveC/NSObjectProtocol/superclass

type NSUInteger

type NSUInteger = uint

NSUInteger is describes an unsigned integer.

See: https://developer.apple.com/documentation/ObjectiveC/NSUInteger

type NXHashState

type NXHashState struct {
	I int
	J int
}

C struct types NXHashState

[Full Topic] [Full Topic]: https://developer.apple.com/documentation/ObjectiveC/NXHashState

func NXInitHashState deprecated

func NXInitHashState(table *NXHashTable) NXHashState

NXInitHashState.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXInitHashState

type NXHashTable

type NXHashTable struct {
	Buckets   unsafe.Pointer
	Count     uint
	Info      unsafe.Pointer
	NbBuckets uint
	Prototype *NXHashTablePrototype
}

NXHashTable

[Full Topic] [Full Topic]: https://developer.apple.com/documentation/ObjectiveC/NXHashTable

func NXCopyHashTable deprecated

func NXCopyHashTable(table *NXHashTable) *NXHashTable

NXCopyHashTable.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXCopyHashTable

func NXCreateHashTable deprecated

func NXCreateHashTable(prototype NXHashTablePrototype, capacity uint, info unsafe.Pointer) *NXHashTable

NXCreateHashTable.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXCreateHashTable

func NXCreateHashTableFromZone deprecated

func NXCreateHashTableFromZone(prototype NXHashTablePrototype, capacity uint, info unsafe.Pointer, zone unsafe.Pointer) *NXHashTable

NXCreateHashTableFromZone.

Deprecated: Deprecated since macOS 10.1.

See: https://developer.apple.com/documentation/ObjectiveC/NXCreateHashTableFromZone

type NXHashTablePrototype

type NXHashTablePrototype struct {
	Free    func(unsafe.Pointer, unsafe.Pointer)
	Hash    func(unsafe.Pointer, unsafe.Pointer) uint
	IsEqual func(unsafe.Pointer, unsafe.Pointer, unsafe.Pointer) int
	Style   int
}

NXHashTablePrototype

[Full Topic] [Full Topic]: https://developer.apple.com/documentation/ObjectiveC/NXHashTablePrototype

type ObjC

type ObjC uint
const (
	OBJC_COLLECT_IF_NEEDED       ObjC = 8
	OBJC_EXHAUSTIVE_COLLECTION   ObjC = 3
	OBJC_FULL_COLLECTION         ObjC = 2
	OBJC_GENERATIONAL_COLLECTION ObjC = 1
	OBJC_RATIO_COLLECTION        ObjC = 0
	OBJC_WAIT_UNTIL_DONE         ObjC = 16
)

func (ObjC) String

func (e ObjC) String() string

type ObjCClearResidentStack

type ObjCClearResidentStack uint
const (
	OBJC_CLEAR_RESIDENT_STACK ObjCClearResidentStack = 1
)

func (ObjCClearResidentStack) String

func (e ObjCClearResidentStack) String() string

type ObjCSync

type ObjCSync uint
const (
	OBJC_SYNC_NOT_OWNING_THREAD_ERROR ObjCSync = 0
	OBJC_SYNC_SUCCESS                 ObjCSync = 0
)

func (ObjCSync) String

func (e ObjCSync) String() string

type Objc_AssociationPolicy

type Objc_AssociationPolicy int

See: https://developer.apple.com/documentation/ObjectiveC/objc_AssociationPolicy

const (
	// OBJC_ASSOCIATION_ASSIGN: Specifies an unsafe unretained reference to the associated object.
	OBJC_ASSOCIATION_ASSIGN Objc_AssociationPolicy = 0
	// OBJC_ASSOCIATION_COPY: Specifies that the associated object is copied, and that the association is made atomically.
	OBJC_ASSOCIATION_COPY Objc_AssociationPolicy = 771
	// OBJC_ASSOCIATION_COPY_NONATOMIC: Specifies that the associated object is copied, and that the association is not made atomically.
	OBJC_ASSOCIATION_COPY_NONATOMIC Objc_AssociationPolicy = 3
	// OBJC_ASSOCIATION_RETAIN: Specifies a strong reference to the associated object, and that the association is made atomically.
	OBJC_ASSOCIATION_RETAIN Objc_AssociationPolicy = 769
	// OBJC_ASSOCIATION_RETAIN_NONATOMIC: Specifies a strong reference to the associated object, and that the association is not made atomically.
	OBJC_ASSOCIATION_RETAIN_NONATOMIC Objc_AssociationPolicy = 1
)

func (Objc_AssociationPolicy) String

func (e Objc_AssociationPolicy) String() string

type Objc_category

type Objc_category struct{}

type Objc_class

type Objc_class struct{}

type Objc_ivar

type Objc_ivar struct{}

type Objc_method

type Objc_method struct{}

type Objc_method_description

type Objc_method_description struct {
	Name  SEL   // The name of the method at runtime.
	Types *byte // The types of the method arguments.

}

Objc_method_description - Defines an Objective-C method.

[Full Topic] [Full Topic]: https://developer.apple.com/documentation/ObjectiveC/objc_method_description

func Method_getDescription

func Method_getDescription(m Method) *Objc_method_description

Method_getDescription returns a method description structure for a specified method.

See: https://developer.apple.com/documentation/ObjectiveC/method_getDescription(_:)

func Protocol_copyMethodDescriptionList

func Protocol_copyMethodDescriptionList(proto **Protocol, isRequiredMethod bool, isInstanceMethod bool, outCount *uint) *Objc_method_description

Protocol_copyMethodDescriptionList returns an array of method descriptions of methods meeting a given specification for a given protocol.

See: https://developer.apple.com/documentation/ObjectiveC/protocol_copyMethodDescriptionList(_:_:_:_:)

type Objc_object

type Objc_object struct {
	Isa objc.Class // A pointer to the class definition of which this object is an instance.

}

Objc_object - Represents an instance of a class.

[Full Topic] [Full Topic]: https://developer.apple.com/documentation/ObjectiveC/objc_object

type Objc_property

type Objc_property struct{}

type Objc_property_attribute_t

type Objc_property_attribute_t struct {
	Name  *byte // The name of the attribute.
	Value *byte // The value of the attribute (usually empty).

}

Objc_property_attribute_t - Defines a property attribute.

[Full Topic] [Full Topic]: https://developer.apple.com/documentation/ObjectiveC/objc_property_attribute_t

func Property_copyAttributeList

func Property_copyAttributeList(property unsafe.Pointer, outCount *uint) *Objc_property_attribute_t

Property_copyAttributeList returns an array of property attributes for a given property.

See: https://developer.apple.com/documentation/ObjectiveC/property_copyAttributeList(_:_:)

type Objc_property_t

type Objc_property_t = unsafe.Pointer

Objc_property_t is an opaque type that represents an Objective-C declared property.

See: https://developer.apple.com/documentation/ObjectiveC/objc_property_t

func Class_copyPropertyList

func Class_copyPropertyList(cls objc.Class, outCount *uint) *Objc_property_t

Class_copyPropertyList describes the properties declared by a class.

See: https://developer.apple.com/documentation/ObjectiveC/class_copyPropertyList(_:_:)

func Protocol_copyPropertyList

func Protocol_copyPropertyList(proto **Protocol, outCount *uint) *Objc_property_t

Protocol_copyPropertyList returns an array of the properties declared by a protocol.

See: https://developer.apple.com/documentation/ObjectiveC/protocol_copyPropertyList(_:_:)

func Protocol_copyPropertyList2

func Protocol_copyPropertyList2(proto **Protocol, outCount *uint, isRequiredProperty bool, isInstanceProperty bool) *Objc_property_t

Protocol_copyPropertyList2.

See: https://developer.apple.com/documentation/ObjectiveC/protocol_copyPropertyList2(_:_:_:_:)

type Objc_selector

type Objc_selector struct{}

type Objc_super

type Objc_super struct {
	Receiver    unsafe.Pointer // A pointer of type [objc_object](<doc://com.apple.objectivec/documentation/ObjectiveC/objc_object>). Specifies an instance of a class.
	Super_class objc.Class     // A pointer to a [Class](<doc://com.apple.objectivec/documentation/ObjectiveC/Class>) data structure. Specifies the particular superclass of the instance to message.

}

Objc_super - Specifies the superclass of an instance.

[Full Topic] [Full Topic]: https://developer.apple.com/documentation/ObjectiveC/objc_super-swift.struct

type Object

type Object struct {
	ID objc.ID
}

Object wraps an Objective-C object ID. This is the base type embedded by all generated class types.

func Class_createInstance

func Class_createInstance(cls objc.Class, extraBytes uintptr) Object

Class_createInstance creates an instance of a class, allocating memory for the class in the default malloc memory zone.

See: https://developer.apple.com/documentation/ObjectiveC/class_createInstance(_:_:)

func Class_createInstanceFromZone deprecated

func Class_createInstanceFromZone(arg0 objc.Class, idxIvars uintptr, zone unsafe.Pointer) Object

Class_createInstanceFromZone.

Deprecated: Deprecated since macOS 10.5.

See: https://developer.apple.com/documentation/ObjectiveC/class_createInstanceFromZone

func Imp_getBlock

func Imp_getBlock(anImp IMP) Object

Imp_getBlock returns the block associated with an IMP that was created using imp_implementationWithBlock(_:).

See: https://developer.apple.com/documentation/ObjectiveC/imp_getBlock(_:)

func Objc_constructInstance

func Objc_constructInstance(cls objc.Class, bytes unsafe.Pointer) Object

Objc_constructInstance creates an instance of a class at the specified location.

See: https://developer.apple.com/documentation/ObjectiveC/objc_constructInstance

func Objc_getAssociatedObject

func Objc_getAssociatedObject(object Object, key unsafe.Pointer) Object

Objc_getAssociatedObject returns the value associated with a given object for a given key.

See: https://developer.apple.com/documentation/ObjectiveC/objc_getAssociatedObject(_:_:)

func Objc_getClass

func Objc_getClass(name string) Object

Objc_getClass returns the class definition of a specified class.

See: https://developer.apple.com/documentation/ObjectiveC/objc_getClass(_:)

func Objc_getMetaClass

func Objc_getMetaClass(name string) Object

Objc_getMetaClass returns the metaclass definition of a specified class.

See: https://developer.apple.com/documentation/ObjectiveC/objc_getMetaClass(_:)

func Objc_loadWeak

func Objc_loadWeak(location uintptr) Object

Objc_loadWeak loads the object referenced by a weak pointer and returns it.

See: https://developer.apple.com/documentation/ObjectiveC/objc_loadWeak(_:)

func Objc_storeWeak

func Objc_storeWeak(location uintptr, obj Object) Object

Objc_storeWeak stores a new value in a `__weak` variable.

See: https://developer.apple.com/documentation/ObjectiveC/objc_storeWeak(_:_:)

func ObjectFromID

func ObjectFromID(id objc.ID) Object

ObjectFromID creates an Object from an objc.ID.

func Object_copy

func Object_copy(obj Object, size uintptr) Object

Object_copy returns a copy of a given object.

See: https://developer.apple.com/documentation/ObjectiveC/object_copy

func Object_copyFromZone deprecated

func Object_copyFromZone(anObject Object, nBytes uintptr, zone unsafe.Pointer) Object

Object_copyFromZone.

Deprecated: Deprecated since macOS 10.5.

See: https://developer.apple.com/documentation/ObjectiveC/object_copyFromZone

func Object_dispose

func Object_dispose(obj Object) Object

Object_dispose frees the memory occupied by a given object.

See: https://developer.apple.com/documentation/ObjectiveC/object_dispose

func Object_getIvar

func Object_getIvar(obj Object, ivar Ivar) Object

Object_getIvar reads the value of an instance variable in an object.

See: https://developer.apple.com/documentation/ObjectiveC/object_getIvar(_:_:)

func (Object) Autorelease

func (o Object) Autorelease()

Autorelease adds the object to the current autorelease pool.

func (Object) DebugDescription

func (o Object) DebugDescription() string

DebugDescription returns the object's debug description as a Go string.

func (Object) Description

func (o Object) Description() string

Description returns the object's description as a Go string.

func (Object) GetID

func (o Object) GetID() objc.ID

GetID returns the underlying Objective-C object ID.

func (Object) Release

func (o Object) Release()

Release decrements the reference count of the object.

func (Object) RespondsToSelector

func (o Object) RespondsToSelector(sel objc.SEL) bool

RespondsToSelector returns true if the object responds to the given selector.

func (Object) Retain

func (o Object) Retain()

Retain increments the reference count of the object.

func (Object) String

func (o Object) String() string

String implements fmt.Stringer by calling Description.

type Protocol

type Protocol struct {
	Object
}

See: https://developer.apple.com/documentation/ObjectiveC/Protocol

func Class_copyProtocolList

func Class_copyProtocolList(cls objc.Class, outCount *uint) **Protocol

Class_copyProtocolList describes the protocols adopted by a class.

See: https://developer.apple.com/documentation/ObjectiveC/class_copyProtocolList(_:_:)

func NewProtocol

func NewProtocol() Protocol

NewProtocol creates a new Protocol instance.

func Objc_allocateProtocol

func Objc_allocateProtocol(name string) **Protocol

Objc_allocateProtocol creates a new protocol instance.

See: https://developer.apple.com/documentation/ObjectiveC/objc_allocateProtocol(_:)

func Objc_copyProtocolList

func Objc_copyProtocolList(outCount *uint) **Protocol

Objc_copyProtocolList returns an array of all the protocols known to the runtime.

See: https://developer.apple.com/documentation/ObjectiveC/objc_copyProtocolList(_:)

func Objc_getProtocol

func Objc_getProtocol(name string) **Protocol

Objc_getProtocol returns a specified protocol.

See: https://developer.apple.com/documentation/ObjectiveC/objc_getProtocol(_:)

func ProtocolFromID

func ProtocolFromID(id objc.ID) Protocol

ProtocolFromID constructs a Protocol from an objc.ID.

func Protocol_copyProtocolList

func Protocol_copyProtocolList(proto **Protocol, outCount *uint) **Protocol

Protocol_copyProtocolList returns an array of the protocols adopted by a protocol.

See: https://developer.apple.com/documentation/ObjectiveC/protocol_copyProtocolList(_:_:)

func (Protocol) Autorelease

func (p Protocol) Autorelease() Protocol

Autorelease adds the receiver to the current autorelease pool.

func (Protocol) Init

func (p Protocol) Init() Protocol

Init initializes the instance.

type ProtocolClass

type ProtocolClass struct {
	// contains filtered or unexported fields
}

func GetProtocolClass

func GetProtocolClass() ProtocolClass

GetProtocolClass returns the class object for Protocol.

func (ProtocolClass) Alloc

func (pc ProtocolClass) Alloc() Protocol

Alloc allocates memory for a new instance of the class.

type SEL

type SEL = uintptr

SEL is defines an opaque type that represents a method selector.

See: https://developer.apple.com/documentation/ObjectiveC/SEL

func Method_getName

func Method_getName(m Method) SEL

Method_getName returns the name of a method.

See: https://developer.apple.com/documentation/ObjectiveC/method_getName(_:)

func Sel_getUid

func Sel_getUid(str string) SEL

Sel_getUid registers a method name with the Objective-C runtime system.

See: https://developer.apple.com/documentation/ObjectiveC/sel_getUid(_:)

func Sel_registerName

func Sel_registerName(str string) SEL

Sel_registerName registers a method with the Objective-C runtime system, maps the method name to a selector, and returns the selector value.

See: https://developer.apple.com/documentation/ObjectiveC/sel_registerName(_:)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL