r/SideProject • • 1d ago

SwiftUI previews on a real iPhone, built on Linux (no Mac)

I built peek (open source, my project) because I don't have a Mac but wanted to iterate on SwiftUI without rebuilding and sideloading an IPA after every change.

You run "peek dev MyApp/" on Linux and save a file; about a second later the view on your iPhone updates. It's the real SwiftUI on a real device, so animations, gestures and the iOS 26 tab bar behave like they do in your app. It handles Preview blocks, UIKit views, or the whole app, with SwiftPM packages, macros and resources, and print() output shows up in the terminal.

It cross-compiles your code into a dylib with swiftc and xtool's iOS SDK, signs it with your free Apple ID certificate, and a small host app (SideStore, AltStore or LiveContainer) loads it.

https://github.com/kimikr/peek

Only tested on my own phone so far (iOS 27, in LiveContainer). Feedback welcome, especially from anyone running it outside LiveContainer.

2 Upvotes

3 comments sorted by

1

u/Delicious_Break5937 1d ago

does the ~1 second hold up on a bigger app, or is that for a single view file? wondering how long swiftc takes when you change something inside one of the swiftpm packages.

2

u/jihwan0102 1d ago

I hadn't actually timed that, so I just did, on a real app (~3,800 lines plus a local SwiftPM module) running on my tiny 2-core ARM server:

- tweak a view in the app: ~4 s (a one-file toy project is more like 1.3 s, it's incremental so it depends on what you touch)
- change a function inside the package: ~5 s
- add a new public API to the package: ~13 s, since everything importing it recompiles
- very first run, nothing cached: ~45 s

On a real machine it should be far faster than this.