Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Welcome to Nifty

Nifty is a small, friendly programming language for building real desktop apps, with real buttons, text fields and windows from your operating system.

Here is a complete Nifty app. It’s a window with a number and two buttons:

state count = 0

window("Counter", width: 320, height: 200) {
  column(spacing: 12, align: .center, justify: .center) {
    label("Clicked {count} times", style: .title)
    row(spacing: 8) {
      button("−") { count -= 1 }
      button("+", style: .primary) { count += 1 }
    }
  }
}

That’s the whole program. No setup code, no event listeners, no “refresh the screen” step. When you click +, count changes, and the label that shows count updates by itself.

Why Nifty?

  • It’s small. You can learn the whole language in an afternoon. This book covers all of it.
  • It looks native. Nifty uses your operating system’s own widgets, so apps look and feel like every other app on your computer, including dark mode and system fonts.
  • The UI updates itself. You say what the screen shows. Nifty works out when each part needs to change, and updates only those parts.
  • Change it while it runs. nf dev reloads your app every time you save, and keeps what it remembered, so you see each change in a moment.
  • Mistakes are caught early. Nifty checks your program before it runs and explains problems in plain words, like `label` shows text; turn this `int` into text with "{…}".

Where Nifty is today: Nifty is young (version 0). It runs and builds apps on macOS and Windows; Linux comes next. See What Nifty supports.

Where to go from here

How this book is organized

PartRead it when…
Getting startedyou want Nifty installed and an app on screen.
Tutorialsyou’d like to learn by building something, one step at a time.
The guideyou want each idea explained properly, with examples.
Referenceyou know what you’re looking for and need the exact details.
Under the hoodyou’re curious how Nifty works, or want to help build it.

Code in this book that looks like this is something you type or something Nifty prints. Every page has an edit button (top right) if you spot something to fix.