Build
Your first app.
Satisfaction apps are two small files. This is a complete, working counter.
Beta. The Developer app and Satisfaction are part of the W-OS beta channel. Turn on Beta updates in Settings → Updates, then open Beta features → Developer.
- Create a projectOpen the Developer app and choose a name. It makes
app.json,main.satifandmain.satUIfor you. - Write the logicVariables, functions and a call to
render()to redraw the screen. - Describe the screenA declarative view tree that is re-evaluated against your program's live state.
- Run, then installRun shows it in a window. Install puts it in your own home folder, never touching the OS itself.
// main.satif
var count = 0
func increment() {
count = count + 1
render()
}
func decrement() {
count = count - 1
render()
}
// main.satUI
View {
Text("Satisfaction Counter")
Text("Count: \(count)")
HStack {
Button("-") { decrement() }
Button("+") { increment() }
}
Spacer
}
The language in one table
| Thing | How it looks |
|---|---|
| Values | numbers, strings, booleans, nil, lists [1, 2], maps ["a": 1], functions |
| Variables | let (fixed) and var (changeable). No type annotations. |
| Control flow | if/else, while, for x in list, break, continue, return, cond ? a : b |
| Strings | Interpolation: "Count: \(count)" |
| Several files | import "name" pulls in another .satif from the same project |
| Errors | Always Line N: what went wrong, in plain English |
One screen file per app for now (main.satUI); extra logic files are supported.