Documentation
¶
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 ¶
- func ComputeAllEmittedStructNames(frameworks []*meta.FrameworkMeta) map[string]bool
- func ComputeByteArrayStructs(frameworks []*meta.FrameworkMeta, mapper *typemap.Mapper) map[string]bool
- func ComputeEmittableStructs(frameworks []*meta.FrameworkMeta, mapper *typemap.Mapper) map[string]bool
- func ComputeIdiomaticClassIndex(frameworks []*meta.FrameworkMeta, ownerIndex map[string]string) map[string]typemap.IdiomaticClassRef
- func EmitFrameworkWrappers(outDir, pkgName, rawPkgAlias, rawPkgPath string, framework *meta.FrameworkMeta, ...) error
- func EmitSupportPackages(rootDir string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeAllEmittedStructNames ¶ added in v0.17.0
func ComputeAllEmittedStructNames(frameworks []*meta.FrameworkMeta) map[string]bool
ComputeAllEmittedStructNames returns every value-struct Go name the idiomatic layer physically writes across all frameworks — the broad, degrade-don't-drop set emitStructs actually emits (available, exported, first-seen), INCLUDING opaque structs and ones with degraded fields that ComputeEmittableStructs (the clean subset) omits. A cross-framework typedef alias needs its target to merely exist, so it consults this set. Name collisions with a class/enum in the owning framework are resolved per-framework at emit time via `taken`, which is not known globally here; the small over-approximation is harmless — a genuinely skipped target would dangle and be caught by the build.
func ComputeByteArrayStructs ¶ added in v0.18.0
func ComputeByteArrayStructs( frameworks []*meta.FrameworkMeta, mapper *typemap.Mapper, ) map[string]bool
ComputeByteArrayStructs returns the value-struct Go names the idiomatic layer emits as a byte-array backing struct + typed accessors (the second admission tier). A struct qualifies when the CLEAN layout path rejects it (it would otherwise degrade every field to unsafe.Pointer) but its exact size and field offsets are known and every field resolves to a concrete primitive/array Go type an accessor can name. Today this captures packed-misaligned structs (Go padding cannot reproduce their layout, but reads at exact offsets can). The set is disjoint from ComputeEmittableStructs (clean layout) by construction, and is kept OUT of the by-value EmittableStructs gate — a [N]byte cannot be passed by value correctly (float register classification). mapper.EmittableStructs must already be populated (the generator computes it before this).
func ComputeEmittableStructs ¶
func ComputeIdiomaticClassIndex ¶ added in v0.16.0
func ComputeIdiomaticClassIndex( frameworks []*meta.FrameworkMeta, ownerIndex map[string]string, ) map[string]typemap.IdiomaticClassRef
ComputeIdiomaticClassIndex maps every ObjC class emitted by the idiomatic layer to its owning idiomatic package and wrapper type name ("NSProgress" → {foundation, Progress}). Only each class's canonical owner (ownerIndex) contributes, and only frameworks the idiomatic generator actually emits (callers pass the already-filtered framework list), so a reference built from this index always names a type that exists. Every available class in an emitted framework gets a wrapper file — a non-abstract class always carries at least its +new constructor and an abstract base is emitted for embedding — so no per-class emission check is needed.
func EmitFrameworkWrappers ¶
func EmitFrameworkWrappers( outDir, pkgName, rawPkgAlias, rawPkgPath string, framework *meta.FrameworkMeta, mapper *typemap.Mapper, idio *idioconf.File, manifest *emitmanifest.Recorder, ) error
EmitFrameworkWrappers generates one *_generated.go file per ObjC class in framework. idio is the framework's parsed idiomatic.json sidecar (curated renames, delegate selection, error typedefs); nil when the framework has none.
func EmitSupportPackages ¶
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.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package render: name-based execution for the construct emitters that render an ad-hoc view by template name rather than through a typed Render* function.
|
Package render: name-based execution for the construct emitters that render an ad-hoc view by template name rather than through a typed Render* function. |
|
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. |