Help us shape the future of Go! Take the 2026 Go Developer Survey

objc

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package objc provides Objective-C runtime bindings using purego.

Index

Constants

View Source
const (
	RTLD_NOW    = basepurego.RTLD_NOW
	RTLD_GLOBAL = basepurego.RTLD_GLOBAL
)

RTLD constants for Dlopen

Variables

This section is empty.

Functions

func AddMethod

func AddMethod(cls Class, sel SEL, impl any, types string) bool

AddMethod adds a new method to a class. impl must be a uintptr from purego.NewCallback.

func Dlopen

func Dlopen(path string, mode int) (uintptr, error)

Dlopen loads a dynamic library.

func GoString

func GoString(nsstr ID) string

GoString converts an NSString to a Go string.

func NewCallback

func NewCallback(fn any) uintptr

NewCallback creates a Go callback for C.

func RegisterClassPair

func RegisterClassPair(cls Class)

RegisterClassPair registers a class pair with the runtime.

func Send

func Send[T any](id ID, sel SEL, args ...any) T

Send calls objc_msgSend with the given arguments.

Types

type Block

type Block = purego.Block

Type aliases from purego/objc

func NewBlock

func NewBlock(fn any) Block

NewBlock creates an Objective-C block from a Go function. The Go function must take a Block as its first argument. Use Block.Release() to free the block when done.

type Class

type Class = purego.Class

Type aliases from purego/objc

func AllocateClassPair

func AllocateClassPair(super Class, name string, extraBytes int) Class

AllocateClassPair calls objc_allocateClassPair.

func GetClass

func GetClass(name string) Class

GetClass returns the Objective-C class with the given name.

type ID

type ID = purego.ID

Type aliases from purego/objc

func NSString

func NSString(s string) ID

NSString converts a Go string to an NSString object.

type Protocol

type Protocol = purego.Protocol

Type aliases from purego/objc

type SEL

type SEL = purego.SEL

Type aliases from purego/objc

func Sel

func Sel(name string) SEL

Sel returns a cached selector for the given name.

Jump to

Keyboard shortcuts

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