gitmyhub

Tweaks

Objective-C ★ 4.7k updated 5y ago ▣ archived

An easy way to fine-tune, and adjust parameters for iOS apps in development.

Tweaks is a library for iOS app developers that makes it easy to adjust settings and parameters inside a running app during development, without changing code or reconnecting to a computer. It was originally built by the team at Facebook, used heavily when building their Paper app, and has since been open-sourced.

The core idea is replacing hard-coded constants in your code with named adjustable values called tweaks. Animation durations, color values, feature flags, physics constants: any numeric, boolean, or string value you want to experiment with can be swapped in through a built-in settings panel on the device. In release builds, the macros compile down to plain default values, so there is no performance cost when shipping to users.

There are three main ways to use a tweak. The first is FBTweakValue, which substitutes for a constant and returns the current tweak value (or the default in release mode). The second is FBTweakBind, which keeps a property on an object updated live as you adjust the tweak from the settings panel. The third is FBTweakAction, which runs a block of code when the tweak is tapped, useful for launching debug screens or testing crash reporting.

The settings panel can appear either by shaking the device or by presenting it from code. Facebook recommends showing it only in debug builds. The underlying objects that power the macros are also accessible directly, which covers more advanced use cases like adjusting fields inside a C structure. The library also works from Swift, though without the shortcut macros.

The project is archived, meaning it is no longer actively maintained by the original team. It remains available for iOS apps written in Objective-C, with limited but possible use in Swift projects.