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 ¶
- func ClassSliceToNSArray(slice []objc.Class) objc.ID
- func Class_addIvar(cls objc.Class, name string, size uintptr, alignment uint8, types string) bool
- func Class_addMethod(cls objc.Class, name SEL, imp IMP, types string) bool
- func Class_addProperty(cls objc.Class, name string, attributes *Objc_property_attribute_t, ...) bool
- func Class_addProtocol(cls objc.Class, protocol_ **Protocol) bool
- func Class_conformsToProtocol(cls objc.Class, protocol_ **Protocol) bool
- func Class_getImageName(cls objc.Class) *byte
- func Class_getInstanceSize(cls objc.Class) uintptr
- func Class_getIvarLayout(cls objc.Class) *uint8
- func Class_getName(cls objc.Class) *byte
- func Class_getProperty(cls objc.Class, name string) unsafe.Pointer
- func Class_getSuperclass(cls objc.Class) objc.Class
- func Class_getVersion(cls objc.Class) int
- func Class_getWeakIvarLayout(cls objc.Class) *uint8
- func Class_isMetaClass(cls objc.Class) bool
- func Class_replaceProperty(cls objc.Class, name string, attributes *Objc_property_attribute_t, ...)
- func Class_respondsToSelector(cls objc.Class, sel SEL) bool
- func Class_setIvarLayout(cls objc.Class, layout *uint8)
- func Class_setVersion(cls objc.Class, version int)
- func Class_setWeakIvarLayout(cls objc.Class, layout *uint8)
- func IDSliceToNSArray(slice []objc.ID) objc.ID
- func IObjectSliceToNSArray[T IObject](slice []T) objc.ID
- func Imp_removeBlock(anImp IMP) bool
- func Ivar_getName(v Ivar) *byte
- func Ivar_getOffset(v Ivar) int
- func Ivar_getTypeEncoding(v Ivar) *byte
- func Method_copyArgumentType(m Method, index uint) *byte
- func Method_copyReturnType(m Method) *byte
- func Method_exchangeImplementations(m1 Method, m2 Method)
- func Method_getArgumentType(m Method, index uint, dst *byte, dst_len uintptr)
- func Method_getNumberOfArguments(m Method) uint
- func Method_getReturnType(m Method, dst *byte, dst_len uintptr)
- func Method_getTypeEncoding(m Method) *byte
- func Method_invoke()
- func NXCompareHashTables(table1 *NXHashTable, table2 *NXHashTable) booldeprecated
- func NXCountHashTable(table *NXHashTable) uintdeprecated
- func NXEmptyHashTable(table *NXHashTable)deprecated
- func NXFreeHashTable(table *NXHashTable)deprecated
- func NXHashGet(table *NXHashTable, data unsafe.Pointer) unsafe.Pointerdeprecated
- func NXHashInsert(table *NXHashTable, data unsafe.Pointer) unsafe.Pointerdeprecated
- func NXHashInsertIfAbsent(table *NXHashTable, data unsafe.Pointer) unsafe.Pointerdeprecated
- func NXHashMember(table *NXHashTable, data unsafe.Pointer) intdeprecated
- func NXHashRemove(table *NXHashTable, data unsafe.Pointer) unsafe.Pointerdeprecated
- func NXNextHashState(table *NXHashTable, state *NXHashState, data unsafe.Pointer) intdeprecated
- func NXNoEffectFree(info unsafe.Pointer, data unsafe.Pointer)deprecated
- func NXPtrHash(info unsafe.Pointer, data unsafe.Pointer) uintptrdeprecated
- func NXPtrIsEqual(info unsafe.Pointer, data1 unsafe.Pointer, data2 unsafe.Pointer) intdeprecated
- func NXReallyFree(info unsafe.Pointer, data unsafe.Pointer)deprecated
- func NXResetHashTable(table *NXHashTable)deprecated
- func NXStrHash(info unsafe.Pointer, data unsafe.Pointer) uintptrdeprecated
- func NXStrIsEqual(info unsafe.Pointer, data1 unsafe.Pointer, data2 unsafe.Pointer) intdeprecated
- func Objc_addExceptionHandler(fn unsafe.Pointer, context unsafe.Pointer) uintptr
- func Objc_addLoadImageFunc(func_ unsafe.Pointer)
- func Objc_allocateClassPair(superclass objc.Class, name string, extraBytes uintptr) objc.Class
- func Objc_copyClassList(outCount *uint) objc.Class
- func Objc_copyClassNamesForImage(image string, outCount *uint) *byte
- func Objc_copyImageNames(outCount *uint) *byte
- func Objc_destructInstance(obj Object) unsafe.Pointer
- func Objc_disposeClassPair(cls objc.Class)
- func Objc_duplicateClass(original objc.Class, name string, extraBytes uintptr) objc.Class
- func Objc_end_catch()
- func Objc_enumerateClasses(image unsafe.Pointer, namePrefix string, conformingTo **Protocol, ...)
- func Objc_enumerationMutation(obj Object)
- func Objc_exception_rethrow()
- func Objc_exception_throw(exception Object)
- func Objc_getClassList(buffer objc.Class, bufferCount int) int
- func Objc_getFutureClass(name string) objc.Class
- func Objc_getRequiredClass(name string) objc.Class
- func Objc_lookUpClass(name string) objc.Class
- func Objc_msgSend()
- func Objc_msgSendSuper()
- func Objc_registerClassPair(cls objc.Class)
- func Objc_registerProtocol(proto **Protocol)
- func Objc_removeAssociatedObjects(object Object)
- func Objc_removeExceptionHandler(token uintptr)
- func Objc_setAssociatedObject(object Object, key unsafe.Pointer, value Object, policy uintptr)
- func Objc_setEnumerationMutationHandler(handler func(Object))
- func Objc_setExceptionMatcher(fn unsafe.Pointer) unsafe.Pointer
- func Objc_setExceptionPreprocessor(fn unsafe.Pointer) unsafe.Pointer
- func Objc_setForwardHandler(fwd unsafe.Pointer, fwd_stret unsafe.Pointer)
- func Objc_setHook_getClass(newValue unsafe.Pointer, outOldValue *Objc_hook_getClass)
- func Objc_setHook_getImageName(newValue unsafe.Pointer, outOldValue *Objc_hook_getImageName)
- func Objc_setHook_lazyClassNamer(newValue unsafe.Pointer, oldOutValue *Objc_hook_lazyClassNamer)
- func Objc_setUncaughtExceptionHandler(fn unsafe.Pointer) unsafe.Pointer
- func Objc_sync_enter(obj Object) int
- func Objc_sync_exit(obj Object) int
- func Objc_terminate()
- func Object_getClass(obj Object) objc.Class
- func Object_getClassName(obj Object) *byte
- func Object_getIndexedIvars(obj Object) unsafe.Pointer
- func Object_isClass(obj Object) bool
- func Object_setClass(obj Object, cls objc.Class) objc.Class
- func Object_setIvar(obj Object, ivar Ivar, value Object)
- func Object_setIvarWithStrongDefault(obj Object, ivar Ivar, value Object)
- func Property_copyAttributeValue(property unsafe.Pointer, attributeName string) *byte
- func Property_getAttributes(property unsafe.Pointer) *byte
- func Property_getName(property unsafe.Pointer) *byte
- func Protocol_addMethodDescription(proto **Protocol, name SEL, types string, isRequiredMethod bool, ...)
- func Protocol_addProperty(proto **Protocol, name string, attributes *Objc_property_attribute_t, ...)
- func Protocol_addProtocol(proto **Protocol, addition **Protocol)
- func Protocol_conformsToProtocol(proto **Protocol, other **Protocol) bool
- func Protocol_getMethodDescription(proto **Protocol, aSel SEL, isRequiredMethod bool, isInstanceMethod bool) unsafe.Pointer
- func Protocol_getName(proto **Protocol) *byte
- func Protocol_getProperty(proto **Protocol, name string, isRequiredProperty bool, ...) unsafe.Pointer
- func Protocol_isEqual(proto **Protocol, other **Protocol) bool
- func Sel_getName(sel SEL) *byte
- func Sel_isEqual(lhs SEL, rhs SEL) bool
- func Sel_isMapped(sel SEL) bool
- func SliceToNSArray[T any](slice []T, toID func(T) objc.ID) objc.ID
- func StringSliceToNSArray(slice []string) objc.ID
- type BOOL
- type Category
- type Class
- type IMP
- type IObject
- type IProtocol
- type Id
- type Ivar
- func Class_copyIvarList(cls objc.Class, outCount *uint) Ivar
- func Class_getClassVariable(cls objc.Class, name string) Ivar
- func Class_getInstanceVariable(cls objc.Class, name string) Ivar
- func Object_getInstanceVariable(obj Object, name string, outValue unsafe.Pointer) Ivar
- func Object_setInstanceVariable(obj Object, name string, value unsafe.Pointer) Ivar
- func Object_setInstanceVariableWithStrongDefault(obj Object, name string, value unsafe.Pointer) Ivar
- type Method
- type NSInteger
- type NSObject
- type NSObjectObject
- func (o NSObjectObject) BaseObject() Object
- func (o NSObjectObject) ConformsToProtocol(aProtocol unsafe.Pointer) bool
- func (o NSObjectObject) DebugDescription() IObject
- func (o NSObjectObject) Description() IObject
- func (o NSObjectObject) Hash() uint
- func (o NSObjectObject) IsEqual(object IObject) bool
- func (o NSObjectObject) IsKindOfClass(aClass objc.Class) bool
- func (o NSObjectObject) IsMemberOfClass(aClass objc.Class) bool
- func (o NSObjectObject) IsProxy() bool
- func (o NSObjectObject) PerformSelector(aSelector objc.SEL) IObject
- func (o NSObjectObject) PerformSelectorWithObject(aSelector objc.SEL, object IObject) IObject
- func (o NSObjectObject) PerformSelectorWithObjectWithObject(aSelector objc.SEL, object1 IObject, object2 IObject) IObject
- func (o NSObjectObject) Release()
- func (o NSObjectObject) RespondsToSelector(aSelector objc.SEL) bool
- func (o NSObjectObject) Retain() IObject
- func (o NSObjectObject) Self() IObject
- func (o NSObjectObject) Superclass() objc.Class
- type NSUInteger
- type NXHashState
- type NXHashTable
- func NXCopyHashTable(table *NXHashTable) *NXHashTabledeprecated
- func NXCreateHashTable(prototype NXHashTablePrototype, capacity uint, info unsafe.Pointer) *NXHashTabledeprecated
- func NXCreateHashTableFromZone(prototype NXHashTablePrototype, capacity uint, info unsafe.Pointer, ...) *NXHashTabledeprecated
- type NXHashTablePrototype
- type ObjC
- type ObjCClearResidentStack
- type ObjCSync
- type Objc_AssociationPolicy
- type Objc_category
- type Objc_class
- type Objc_exception_handler
- type Objc_exception_matcher
- type Objc_exception_preprocessor
- type Objc_func_loadImage
- type Objc_hook_getClass
- type Objc_hook_getImageName
- type Objc_hook_lazyClassNamer
- type Objc_ivar
- type Objc_method
- type Objc_method_description
- type Objc_object
- type Objc_objectptr_t
- type Objc_property
- type Objc_property_attribute_t
- type Objc_property_t
- type Objc_selector
- type Objc_super
- type Objc_uncaught_exception_handler
- type Objc_zone_t
- type Object
- func Class_createInstance(cls objc.Class, extraBytes uintptr) Object
- func Class_createInstanceFromZone(arg0 objc.Class, idxIvars uintptr, zone unsafe.Pointer) Objectdeprecated
- func Imp_getBlock(anImp IMP) Object
- func Objc_begin_catch(exc_buf unsafe.Pointer) Object
- func Objc_constructInstance(cls objc.Class, bytes unsafe.Pointer) Object
- func Objc_getAssociatedObject(object Object, key unsafe.Pointer) Object
- func Objc_getClass(name string) Object
- func Objc_getMetaClass(name string) Object
- func Objc_loadWeak(location uintptr) Object
- func Objc_storeWeak(location uintptr, obj Object) Object
- func ObjectFromID(id objc.ID) Object
- func Object_copy(obj Object, size uintptr) Object
- func Object_copyFromZone(anObject Object, nBytes uintptr, zone unsafe.Pointer) Objectdeprecated
- func Object_dispose(obj Object) Object
- func Object_getIvar(obj Object, ivar Ivar) Object
- type Protocol
- func Class_copyProtocolList(cls objc.Class, outCount *uint) **Protocol
- func NewProtocol() Protocol
- func Objc_allocateProtocol(name string) **Protocol
- func Objc_copyProtocolList(outCount *uint) **Protocol
- func Objc_getProtocol(name string) **Protocol
- func ProtocolFromID(id objc.ID) Protocol
- func Protocol_copyProtocolList(proto **Protocol, outCount *uint) **Protocol
- type ProtocolClass
- type SEL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClassSliceToNSArray ¶
ClassSliceToNSArray converts a slice of objc.Class to an NSArray.
func Class_addIvar ¶
Class_addIvar adds a new instance variable to a class.
See: https://developer.apple.com/documentation/ObjectiveC/class_addIvar(_:_:_:_:_:)
func Class_addMethod ¶
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 ¶
Class_addProtocol adds a protocol to a class.
See: https://developer.apple.com/documentation/ObjectiveC/class_addProtocol(_:_:)
func Class_conformsToProtocol ¶
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 ¶
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 ¶
Class_getInstanceSize returns the size of instances of a class.
See: https://developer.apple.com/documentation/ObjectiveC/class_getInstanceSize(_:)
func Class_getIvarLayout ¶
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 ¶
Class_getName returns the name of a class.
See: https://developer.apple.com/documentation/ObjectiveC/class_getName(_:)
func Class_getProperty ¶
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 ¶
Class_getSuperclass returns the superclass of a class.
See: https://developer.apple.com/documentation/ObjectiveC/class_getSuperclass(_:)
func Class_getVersion ¶
Class_getVersion returns the version number of a class definition.
See: https://developer.apple.com/documentation/ObjectiveC/class_getVersion(_:)
func Class_getWeakIvarLayout ¶
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 ¶
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 ¶
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 ¶
Class_setIvarLayout sets the Ivar layout for a given class.
See: https://developer.apple.com/documentation/ObjectiveC/class_setIvarLayout(_:_:)
func Class_setVersion ¶
Class_setVersion sets the version number of a class definition.
See: https://developer.apple.com/documentation/ObjectiveC/class_setVersion(_:_:)
func Class_setWeakIvarLayout ¶
Class_setWeakIvarLayout sets the layout for weak [Ivar]s for a given class.
See: https://developer.apple.com/documentation/ObjectiveC/class_setWeakIvarLayout(_:_:)
func IDSliceToNSArray ¶
IDSliceToNSArray converts a slice of objc.ID to an NSArray.
func IObjectSliceToNSArray ¶
IObjectSliceToNSArray converts a slice of IObject-implementing types to an NSArray.
func Imp_removeBlock ¶
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 ¶
Ivar_getName returns the name of an instance variable.
See: https://developer.apple.com/documentation/ObjectiveC/ivar_getName(_:)
func Ivar_getOffset ¶
Ivar_getOffset returns the offset of an instance variable.
See: https://developer.apple.com/documentation/ObjectiveC/ivar_getOffset(_:)
func Ivar_getTypeEncoding ¶
Ivar_getTypeEncoding returns the type string of an instance variable.
See: https://developer.apple.com/documentation/ObjectiveC/ivar_getTypeEncoding(_:)
func Method_copyArgumentType ¶
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 ¶
Method_copyReturnType returns a string describing a method’s return type.
See: https://developer.apple.com/documentation/ObjectiveC/method_copyReturnType(_:)
func Method_exchangeImplementations ¶
Method_exchangeImplementations exchanges the implementations of two methods.
See: https://developer.apple.com/documentation/ObjectiveC/method_exchangeImplementations(_:_:)
func Method_getArgumentType ¶
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 ¶
Method_getNumberOfArguments returns the number of arguments accepted by a method.
See: https://developer.apple.com/documentation/ObjectiveC/method_getNumberOfArguments(_:)
func Method_getReturnType ¶
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 ¶
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
NXNoEffectFree.
Deprecated: Deprecated since macOS 10.1.
See: https://developer.apple.com/documentation/ObjectiveC/NXNoEffectFree
func NXPtrIsEqual
deprecated
func NXReallyFree
deprecated
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 NXStrIsEqual
deprecated
func Objc_addExceptionHandler ¶
Objc_addExceptionHandler.
See: https://developer.apple.com/documentation/ObjectiveC/objc_addExceptionHandler(_:_:)
func Objc_addLoadImageFunc ¶
Objc_addLoadImageFunc.
See: https://developer.apple.com/documentation/ObjectiveC/objc_addLoadImageFunc(_:)
func Objc_allocateClassPair ¶
Objc_allocateClassPair creates a new class and metaclass.
See: https://developer.apple.com/documentation/ObjectiveC/objc_allocateClassPair(_:_:_:)
func Objc_copyClassList ¶
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 ¶
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 ¶
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 ¶
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 ¶
Objc_disposeClassPair destroys a class and its associated metaclass.
See: https://developer.apple.com/documentation/ObjectiveC/objc_disposeClassPair(_:)
func Objc_duplicateClass ¶
Objc_duplicateClass used by Foundation’s Key-Value Observing.
See: https://developer.apple.com/documentation/ObjectiveC/objc_duplicateClass(_:_:_:)
func Objc_end_catch ¶
func Objc_end_catch()
Objc_end_catch.
See: https://developer.apple.com/documentation/ObjectiveC/objc_end_catch()
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 ¶
Objc_getClassList obtains the list of registered class definitions.
See: https://developer.apple.com/documentation/ObjectiveC/objc_getClassList(_:_:)
func Objc_getFutureClass ¶
Objc_getFutureClass used by CoreFoundation’s toll-free bridging.
See: https://developer.apple.com/documentation/ObjectiveC/objc_getFutureClass
func Objc_getRequiredClass ¶
Objc_getRequiredClass returns the class definition of a specified class.
See: https://developer.apple.com/documentation/ObjectiveC/objc_getRequiredClass(_:)
func Objc_lookUpClass ¶
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 ¶
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
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_setExceptionMatcher ¶
Objc_setExceptionMatcher.
See: https://developer.apple.com/documentation/ObjectiveC/objc_setExceptionMatcher(_:)
func Objc_setExceptionPreprocessor ¶
Objc_setExceptionPreprocessor.
See: https://developer.apple.com/documentation/ObjectiveC/objc_setExceptionPreprocessor(_:)
func Objc_setForwardHandler ¶
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_setUncaughtExceptionHandler ¶
Objc_setUncaughtExceptionHandler.
See: https://developer.apple.com/documentation/ObjectiveC/objc_setUncaughtExceptionHandler(_:)
func Objc_sync_enter ¶
Objc_sync_enter begin synchronizing on ‘obj’.
See: https://developer.apple.com/documentation/ObjectiveC/objc_sync_enter
func Objc_sync_exit ¶
Objc_sync_exit end synchronizing on ‘obj’.
See: https://developer.apple.com/documentation/ObjectiveC/objc_sync_exit
func Objc_terminate ¶
func Objc_terminate()
Objc_terminate.
See: https://developer.apple.com/documentation/ObjectiveC/objc_terminate()
func Object_getClass ¶
Object_getClass returns the class of an object.
See: https://developer.apple.com/documentation/ObjectiveC/object_getClass(_:)
func Object_getClassName ¶
Object_getClassName returns the class name of a given object.
See: https://developer.apple.com/documentation/ObjectiveC/object_getClassName(_:)
func Object_getIndexedIvars ¶
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_isClass ¶
Object_isClass.
See: https://developer.apple.com/documentation/ObjectiveC/object_isClass(_:)
func Object_setClass ¶
Object_setClass sets the class of an object.
See: https://developer.apple.com/documentation/ObjectiveC/object_setClass(_:_:)
func Object_setIvar ¶
Object_setIvar sets the value of an instance variable in an object.
See: https://developer.apple.com/documentation/ObjectiveC/object_setIvar(_:_:_:)
func Object_setIvarWithStrongDefault ¶
Object_setIvarWithStrongDefault.
See: https://developer.apple.com/documentation/ObjectiveC/object_setIvarWithStrongDefault(_:_:_:)
func Property_copyAttributeValue ¶
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 ¶
Property_getAttributes returns the attribute string of a property.
See: https://developer.apple.com/documentation/ObjectiveC/property_getAttributes(_:)
func Property_getName ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
Sel_isMapped identifies a selector as being valid or invalid.
See: https://developer.apple.com/documentation/ObjectiveC/sel_isMapped(_:)
func SliceToNSArray ¶
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 ¶
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 ¶
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 ¶
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 ¶
Class_replaceMethod replaces the implementation of a method for a given class.
See: https://developer.apple.com/documentation/ObjectiveC/class_replaceMethod(_:_:_:_:)
func Imp_implementationWithBlock ¶
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 ¶
Method_getImplementation returns the implementation of a method.
See: https://developer.apple.com/documentation/ObjectiveC/method_getImplementation(_:)
func Method_setImplementation ¶
Method_setImplementation sets the implementation of a method.
See: https://developer.apple.com/documentation/ObjectiveC/method_setImplementation(_:_:)
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 ¶
Class_copyIvarList describes the instance variables declared by a class.
See: https://developer.apple.com/documentation/ObjectiveC/class_copyIvarList(_:_:)
func Class_getClassVariable ¶
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 ¶
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 ¶
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 ¶
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 ¶
Class_copyMethodList describes the instance methods implemented by a class.
See: https://developer.apple.com/documentation/ObjectiveC/class_copyMethodList(_:_:)
func Class_getClassMethod ¶
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 ¶
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 ¶
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 ObjCClearResidentStack ¶
type ObjCClearResidentStack uint
const (
OBJC_CLEAR_RESIDENT_STACK ObjCClearResidentStack = 1
)
func (ObjCClearResidentStack) String ¶
func (e ObjCClearResidentStack) 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_exception_handler ¶
See: https://developer.apple.com/documentation/ObjectiveC/objc_exception_handler
type Objc_exception_matcher ¶
See: https://developer.apple.com/documentation/ObjectiveC/objc_exception_matcher
type Objc_exception_preprocessor ¶
See: https://developer.apple.com/documentation/ObjectiveC/objc_exception_preprocessor
type Objc_func_loadImage ¶
See: https://developer.apple.com/documentation/ObjectiveC/objc_func_loadImage
type Objc_hook_getClass ¶
See: https://developer.apple.com/documentation/ObjectiveC/objc_hook_getClass
type Objc_hook_getImageName ¶
type Objc_hook_getImageName = string
See: https://developer.apple.com/documentation/ObjectiveC/objc_hook_getImageName
type Objc_hook_lazyClassNamer ¶
See: https://developer.apple.com/documentation/ObjectiveC/objc_hook_lazyClassNamer
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 ¶
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 Objc_uncaught_exception_handler ¶
See: https://developer.apple.com/documentation/ObjectiveC/objc_uncaught_exception_handler
type Objc_zone_t ¶
type Objc_zone_t = uintptr
See: https://developer.apple.com/documentation/ObjectiveC/objc_zone_t
type Object ¶
Object wraps an Objective-C object ID. This is the base type embedded by all generated class types.
func Class_createInstance ¶
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 Imp_getBlock ¶
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_begin_catch ¶
Objc_begin_catch.
See: https://developer.apple.com/documentation/ObjectiveC/objc_begin_catch(_:)
func Objc_constructInstance ¶
Objc_constructInstance creates an instance of a class at the specified location.
See: https://developer.apple.com/documentation/ObjectiveC/objc_constructInstance
func Objc_getAssociatedObject ¶
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 ¶
Objc_getClass returns the class definition of a specified class.
See: https://developer.apple.com/documentation/ObjectiveC/objc_getClass(_:)
func Objc_getMetaClass ¶
Objc_getMetaClass returns the metaclass definition of a specified class.
See: https://developer.apple.com/documentation/ObjectiveC/objc_getMetaClass(_:)
func Objc_loadWeak ¶
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 ¶
Objc_storeWeak stores a new value in a `__weak` variable.
See: https://developer.apple.com/documentation/ObjectiveC/objc_storeWeak(_:_:)
func ObjectFromID ¶
ObjectFromID creates an Object from an objc.ID.
func Object_copy ¶
Object_copy returns a copy of a given object.
See: https://developer.apple.com/documentation/ObjectiveC/object_copy
func Object_copyFromZone
deprecated
func Object_dispose ¶
Object_dispose frees the memory occupied by a given object.
See: https://developer.apple.com/documentation/ObjectiveC/object_dispose
func Object_getIvar ¶
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 ¶
DebugDescription returns the object's debug description as a Go string.
func (Object) Description ¶
Description returns the object's description as a Go string.
func (Object) Release ¶
func (o Object) Release()
Release decrements the reference count of the object.
func (Object) RespondsToSelector ¶
RespondsToSelector returns true if the object responds to the given selector.
type Protocol ¶
type Protocol struct {
Object
}
See: https://developer.apple.com/documentation/ObjectiveC/Protocol
func Class_copyProtocolList ¶
Class_copyProtocolList describes the protocols adopted by a class.
See: https://developer.apple.com/documentation/ObjectiveC/class_copyProtocolList(_:_:)
func Objc_allocateProtocol ¶
Objc_allocateProtocol creates a new protocol instance.
See: https://developer.apple.com/documentation/ObjectiveC/objc_allocateProtocol(_:)
func Objc_copyProtocolList ¶
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 ¶
Objc_getProtocol returns a specified protocol.
See: https://developer.apple.com/documentation/ObjectiveC/objc_getProtocol(_:)
func ProtocolFromID ¶
ProtocolFromID constructs a Protocol from an objc.ID.
func Protocol_copyProtocolList ¶
Protocol_copyProtocolList returns an array of the protocols adopted by a protocol.
See: https://developer.apple.com/documentation/ObjectiveC/protocol_copyProtocolList(_:_:)
func (Protocol) Autorelease ¶
Autorelease adds the receiver to the current autorelease pool.
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 ¶
Method_getName returns the name of a method.
See: https://developer.apple.com/documentation/ObjectiveC/method_getName(_:)
func Sel_getUid ¶
Sel_getUid registers a method name with the Objective-C runtime system.
See: https://developer.apple.com/documentation/ObjectiveC/sel_getUid(_:)
func Sel_registerName ¶
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(_:)