swift

package
v0.0.0-...-6074b66 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var False = Code("false")
View Source
var Null = Code("null")
View Source
var True = Code("true")

Functions

func CreateWriter

func CreateWriter() codeWriter

Types

type CodeWriter

type CodeWriter interface {
	Begin()
	End()
	Eol()
	Write(code string)
	OpenBlock()
	CloseBlock()
}

type Declaration

type Declaration interface {
	Declaration()
	Writable
}

type ImportDeclaration

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

func Import

func Import(moduleName string) ImportDeclaration

func (*ImportDeclaration) WriteCode

func (id *ImportDeclaration) WriteCode(writer CodeWriter)

type StructDecl

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

func NewStruct

func NewStruct(name string) *StructDecl

func (*StructDecl) AddMembers

func (s *StructDecl) AddMembers(members ...Declaration) *StructDecl

func (*StructDecl) Declaration

func (*StructDecl) Declaration()

func (*StructDecl) FilePrivate

func (s *StructDecl) FilePrivate() *StructDecl

func (*StructDecl) Internal

func (s *StructDecl) Internal() *StructDecl

func (*StructDecl) Private

func (s *StructDecl) Private() *StructDecl

func (*StructDecl) Public

func (s *StructDecl) Public() *StructDecl

func (*StructDecl) WriteCode

func (s *StructDecl) WriteCode(writer CodeWriter)

type Unit

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

Unit represents a Swift source file

func NewUnit

func NewUnit() *Unit

func (*Unit) AddDeclarations

func (u *Unit) AddDeclarations(decls ...Declaration) *Unit

func (*Unit) AddImports

func (u *Unit) AddImports(imports ...ImportDeclaration) *Unit

func (*Unit) Code

func (u *Unit) Code() string

func (*Unit) WriteCode

func (u *Unit) WriteCode(writer CodeWriter)

WriteCode implements Writable.

type VarDeclaration

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

func Var

func Var(name, typeName string) *VarDeclaration

func (*VarDeclaration) Declaration

func (v *VarDeclaration) Declaration()

func (*VarDeclaration) FilePrivate

func (v *VarDeclaration) FilePrivate() *VarDeclaration

func (*VarDeclaration) InitWith

func (v *VarDeclaration) InitWith(value Writable) *VarDeclaration

func (*VarDeclaration) Internal

func (v *VarDeclaration) Internal() *VarDeclaration

func (*VarDeclaration) Private

func (v *VarDeclaration) Private() *VarDeclaration

func (*VarDeclaration) Public

func (v *VarDeclaration) Public() *VarDeclaration

func (*VarDeclaration) SimpleAttributes

func (v *VarDeclaration) SimpleAttributes(names ...string) *VarDeclaration

SimpleAttributes adds simple attributes to the variable declaration. Simple here means attributes with no arguments.

func (*VarDeclaration) WriteCode

func (v *VarDeclaration) WriteCode(writer CodeWriter)

type Writable

type Writable interface {
	WriteCode(writer CodeWriter)
}

type WritableCode

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

func C

func C(code string) *WritableCode

func Code

func Code(code string) *WritableCode

func Int

func Int(value int) *WritableCode

func Str

func Str(value string) *WritableCode

func (*WritableCode) WriteCode

func (w *WritableCode) WriteCode(writer CodeWriter)

Jump to

Keyboard shortcuts

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