objcbridge

package
v0.6.10 Latest Latest
Warning

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

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

Documentation

Overview

Package objcbridge contains small Objective-C runtime helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMethods

func AddMethods(cls objc.Class, className string, methods []objc.MethodDef) error

AddMethods installs methods on cls using purego callbacks.

func ProtocolsByName

func ProtocolsByName(names ...string) []*objc.Protocol

ProtocolsByName resolves Objective-C protocols, skipping protocols not present on the running system.

func RequiredProtocolsByName

func RequiredProtocolsByName(names ...string) ([]*objc.Protocol, error)

RequiredProtocolsByName resolves Objective-C protocols and reports any missing protocol.

Types

type BlockInvoker

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

BlockInvoker invokes Objective-C blocks with known signatures.

If a typed shim is linked into the process, BlockInvoker uses that bridge; otherwise it falls back to the block's invoke pointer. Its methods return an error when block is nil or when the fallback invoke pointer cannot be resolved.

func NewBlockInvoker

func NewBlockInvoker() *BlockInvoker

NewBlockInvoker returns a block invoker with no linked shim names.

func NewBlockInvokerWithShims

func NewBlockInvokerWithShims(shims BlockShims) *BlockInvoker

NewBlockInvokerWithShims returns a block invoker that prefers linked typed shims when they are present.

func (*BlockInvoker) BoolError

func (r *BlockInvoker) BoolError(block objc.ID, value bool, errID objc.ID) error

BoolError invokes block(value, err).

func (*BlockInvoker) Error

func (r *BlockInvoker) Error(block objc.ID, errID objc.ID) error

Error invokes block(err).

func (*BlockInvoker) Object

func (r *BlockInvoker) Object(block objc.ID, object objc.ID) error

Object invokes block(object).

func (*BlockInvoker) ObjectError

func (r *BlockInvoker) ObjectError(block objc.ID, object objc.ID, errID objc.ID) error

ObjectError invokes block(object, err).

func (*BlockInvoker) ObjectObject

func (r *BlockInvoker) ObjectObject(block objc.ID, a objc.ID, b objc.ID) error

ObjectObject invokes block(a, b).

func (*BlockInvoker) ObjectObjectError

func (r *BlockInvoker) ObjectObjectError(block objc.ID, a objc.ID, b objc.ID, errID objc.ID) error

ObjectObjectError invokes block(a, b, err).

func (*BlockInvoker) Uint

func (r *BlockInvoker) Uint(block objc.ID, value uint) error

Uint invokes block(value).

func (*BlockInvoker) Uint64Error

func (r *BlockInvoker) Uint64Error(block objc.ID, value uint64, errID objc.ID) error

Uint64Error invokes block(value, err).

func (*BlockInvoker) UintptrError

func (r *BlockInvoker) UintptrError(block objc.ID, value uintptr, errID objc.ID) error

UintptrError invokes block(value, err).

func (*BlockInvoker) Void

func (r *BlockInvoker) Void(block objc.ID) error

Void invokes block().

type BlockShims

type BlockShims struct {
	Error             string
	Object            string
	ObjectObject      string
	Uint              string
	ObjectError       string
	ObjectObjectError string
	Uint64Error       string
	BoolError         string
	UintptrError      string
}

BlockShims names optional linked functions used for typed block invocation.

Jump to

Keyboard shortcuts

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