idiomatic

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Rendered for darwin/amd64

Overview

Package idiomatic emits fluent Go wrapper types for ObjC frameworks.

For each ObjC class the emitter generates a Go wrapper struct exposing:

  • A constructor that bundles alloc+init (or +new) into a single call, converting NSURL/NSString parameters to Go string at the boundary.
  • Fluent With<Prop>(value) *Self methods for every settable property, returning the receiver so calls can be chained.
  • NSArray setters exposed as variadic With<Prop>(items...*T) *Self, building the NSArray from a Go slice internally.
  • Async completion handler methods as (ctx context.Context) error, extracting NSError from unsafe.Pointer via ObjC metadata.
  • NSArray-returning getter methods as typed Go slices ([]T).
  • BoolNSError pairs simplified to plain error returns.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeEmittableStructs added in v0.10.0

func ComputeEmittableStructs(frameworks []*meta.FrameworkMeta, m *typemap.Mapper) map[string]bool

ComputeEmittableStructs returns the set of value-struct Go names (across every framework) the idiomatic layer can emit a definition for: a struct is emittable when every field is a Go primitive or another emittable struct. Iterates to a fixpoint so a struct may depend on one resolved later (CGRect on CGPoint/CGSize). The same set gates both the per-framework struct emission and cross-framework references, so a reference never names a struct that was skipped. An enum-typed field is allowed when the enum is one the same framework emits locally (see ComputeEmittableStructs).

func EmitFrameworkWrappers

func EmitFrameworkWrappers(
	outDir, pkgName, rawPkgAlias, rawPkgPath string,
	fw *meta.FrameworkMeta,
	m *typemap.Mapper,
) error

EmitFrameworkWrappers generates one *_generated.go file per ObjC class in fw.

func EmitSupportPackages added in v0.10.0

func EmitSupportPackages(rootDir string) error

EmitSupportPackages writes the idiomatic layer's hand-independent support packages (objref, errkit, rt) under rootDir. It is idempotent and deterministic: it only writes the known support files (never cleans a directory), so co-located hand-authored or generated framework packages are untouched. Call once per generation, before the per-framework loop.

Types

This section is empty.

Directories

Path Synopsis
Package render turns a fully-resolved view (the IR built by the gather phase) into Go source.
Package render turns a fully-resolved view (the IR built by the gather phase) into Go source.
Package view is the intermediate representation (IR) of a fully-resolved idiomatic framework package.
Package view is the intermediate representation (IR) of a fully-resolved idiomatic framework package.

Jump to

Keyboard shortcuts

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