plugin
Package plugin defines the Drift plugin authoring API.
Plugins are Go modules that contribute build-time and runtime native behaviour to a Drift project. A plugin module exports a single typed Plugin value at <module>/plugin and is wired into a project via drift.yaml.
The wire contract between the Drift CLI and the generated bridge binary (envelope, response, op types, config schema) lives in the protocol sub-package.
The authoring guide (website-docs/guides/plugin-authoring.md) covers writing a plugin and lists every op. examples/plugins/hello is the smallest complete plugin, quoted by the guide; the first-party plugins under plugins/ (splash, firebase) are full references.
Constants
SwiftPM requirement kinds, re-exported from protocol for plugin authors.
const (
SPMFrom = protocol.SPMFrom
SPMExact = protocol.SPMExact
SPMBranch = protocol.SPMBranch
SPMRevision = protocol.SPMRevision
SPMUpToNextMajor = protocol.SPMUpToNextMajor
SPMUpToNextMinor = protocol.SPMUpToNextMinor
SPMRange = protocol.SPMRange
)
TestAppID is the AppID of test contexts (NewTestCtx, NewTestCtxAt, NewTestCtxFor).
const TestAppID = "com.example.app"
func Main
func Main(bindings ...Binding)
Main is the bridge tool entry point. The generated tools/drift-plugins/main.go calls Main with one Binding per configured plugin.
Main panics on duplicate plugin names: the bridge fails fast at startup rather than letting two plugins with the same friendly name confuse later diagnostics. It also panics on duplicate package paths.
type AndroidDrawablesScope
AndroidDrawablesScope writes raw bitmaps under res/drawable-nodpi: Android does not scale them by screen density, so size them where they are used (a layout, a drawable XML's item size).
type AndroidDrawablesScope struct {
// contains filtered or unexported fields
}
func (*AndroidDrawablesScope) AddBitmap
func (s *AndroidDrawablesScope) AddBitmap(name string, content []byte)