ios

– import “gomatcha.io/matcha/view/ios”

Package ios implements a native ios views.

type ActivityIndicator

type ActivityIndicator struct {
}

If any view has an ActivityIndicator option, the spinner will be visible.

return view.Model{
    Options: []view.Option{app.ActivityIndicator{}}
}

func (*ActivityIndicator) OptionKey

func (a *ActivityIndicator) OptionKey() string

type ProgressView

type ProgressView struct {
	view.Embed
	Progress         float64
	ProgressNotifier comm.Float64Notifier
	ProgressColor    color.Color
	PaintStyle       *paint.Style
}

ProgressView implements a progess view.

func NewProgressView

func NewProgressView() *ProgressView

NewProgressView returns a new view.

func (*ProgressView) Build

func (v *ProgressView) Build(ctx view.Context) view.Model

Build implements the view.View interface.

func (*ProgressView) Lifecycle

func (v *ProgressView) Lifecycle(from, to view.Stage)

Lifecycle implements the view.View interface.

type SegmentView

type SegmentView struct {
	view.Embed
	Enabled    bool
	Momentary  bool
	Titles     []string
	Value      int
	OnChange   func(value int)
	PaintStyle *paint.Style
}

func NewSegmentView

func NewSegmentView() *SegmentView

NewSegmentView returns a new view.

func (*SegmentView) Build

func (v *SegmentView) Build(ctx view.Context) view.Model

Build implements view.View.

type Stack

type Stack struct {
}

Stack represents a list of views to be shown in the StackView. It can be manipulated outside of a Build() call.

func (*Stack) Notify

func (s *Stack) Notify(f func()) comm.Id

func (*Stack) Pop

func (s *Stack) Pop()

func (*Stack) Push

func (s *Stack) Push(vs view.View)

func (*Stack) SetViews

func (s *Stack) SetViews(vs ...view.View)

func (*Stack) Unnotify

func (s *Stack) Unnotify(id comm.Id)

func (*Stack) Views

func (s *Stack) Views() []view.View

type StackBar

type StackBar struct {
	Title            string
	BackButtonTitle  string
	BackButtonHidden bool
	LeftItems        []*StackBarItem
	RightItems       []*StackBarItem
}

func (*StackBar) OptionKey

func (t *StackBar) OptionKey() string

type StackBarItem

type StackBarItem struct {
	Enabled    bool
	TintColor  color.Color
	Title      string
	TitleStyle *text.Style
	Image      image.Image
	TintsImage bool
	OnPress    func()
}

func NewImageStackBarItem

func NewImageStackBarItem(image image.Image) *StackBarItem

func NewTitleStackBarItem

func NewTitleStackBarItem(title string) *StackBarItem

type StackView

type StackView struct {
	view.Embed
	Stack          *Stack
	TitleStyle     *text.Style
	BarColor       color.Color
	ItemTitleStyle *text.Style
	ItemTintColor  color.Color
}

Building a simple StackView:

type AppView struct {
    view.Embed
    stack *ios.Stack
}
func NewAppView() *AppView {
    child := view.NewBasicView()
    child.Painter = &paint.Style{BackgroundColor: colornames.Red}
    appview := &AppView{
        stack: &ios.Stack{},
    }
    appview.stack.SetViews(child)
    return appview
}
func (v *AppView) Build(ctx view.Context) view.Model {
    child := ios.NewStackView()
    child.Stack = v.stack
    return view.Model{
        Children: []view.View{child},
    }
}

Modifying the stack:

child := view.NewBasicView()
child.Painter = &paint.Style{BackgroundColor: colornames.Green}
v.Stack.Push(child)

func NewStackView

func NewStackView() *StackView

NewStackView returns a new view.

func (*StackView) Build

func (v *StackView) Build(ctx view.Context) view.Model

Build implements the view.View interface.

func (*StackView) Lifecycle

func (v *StackView) Lifecycle(from, to view.Stage)

Lifecyle implements the view.View interface.

func (*StackView) Update

func (v *StackView) Update(v2 view.View)

type StatusBar

type StatusBar struct {
	Hidden bool
	Style  StatusBarStyle
}

If multiple views have a statusBar, the most recently mounted one will be used. UIViewControllerBasedStatusBarAppearance must be set to True in the app’s Info.plist to use this component.

return view.Model{
    Options: []view.Option{
        &ios.StatusBar{ Style: ios.StatusBarStyleLight },
    },
}

func (*StatusBar) OptionKey

func (s *StatusBar) OptionKey() string

type StatusBarStyle

type StatusBarStyle int
const (
	// Statusbar with light icons
	StatusBarStyleLight StatusBarStyle = iota
	// Statusbar with dark icons
	StatusBarStyleDark
)

type TabButton

type TabButton struct {
	Title        string
	Icon         image.Image
	SelectedIcon image.Image
	Badge        string
}

TabButton describes a UITabBarItem.

func (*TabButton) OptionKey

func (t *TabButton) OptionKey() string

type TabView

type TabView struct {
	view.Embed
	Tabs                *Tabs
	BarColor            color.Color
	SelectedTextStyle   *text.Style
	UnselectedTextStyle *text.Style
	SelectedColor       color.Color
	UnselectedColor     color.Color
}

func NewTabView

func NewTabView() *TabView

NewTabView returns a new view.

func (*TabView) Build

func (v *TabView) Build(ctx view.Context) view.Model

Build implements the view.View interface.

func (*TabView) Lifecycle

func (v *TabView) Lifecycle(from, to view.Stage)

Lifecyle implements the view.View interface.

func (*TabView) Update

func (v *TabView) Update(v2 view.View)

Update implements the view.View interface.

type Tabs

type Tabs struct {
}

Tabs represents a list of views to be shown in the TabView. It can be manipulated outside of a Build() call.

func (*Tabs) Notify

func (s *Tabs) Notify(f func()) comm.Id

Notify implements the comm.Notifier interface.

func (*Tabs) SelectedIndex

func (s *Tabs) SelectedIndex() int

SelectedIndex returns the index of the selected tab.

func (*Tabs) SelectedView

func (s *Tabs) SelectedView() view.View

func (*Tabs) SetSelectedIndex

func (s *Tabs) SetSelectedIndex(idx int)

SetSelectedIndex selects the tab at idx.

func (*Tabs) SetViews

func (s *Tabs) SetViews(ss ...view.View)

SetViews sets the child views displayed in the tabview.

func (*Tabs) Unnotify

func (s *Tabs) Unnotify(id comm.Id)

Unnotify implements the comm.Notifier interface.

func (*Tabs) Views

func (s *Tabs) Views() []view.View

Views returns the child views displayed in the tabview.