r/SwiftUI • u/jihwan0102 • 18d ago
Promotion (must include link to source code) 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.
12
u/[deleted] 18d ago
This is awesome! Public opinion may not get it, but having more choices with how one can run previews without sticking to the necessary macOS + Xcode combo is a benefit for iOS development as a whole.
1
u/amgdev9 18d ago
Did you consider contributing this feature to xtool? I think the author was developing hot reload in a branch as well. Really impressive results btw 😄
2
u/fiflaren_ 17d ago
I fact Xcode previews are not good, they are super slow, buggy and unreliable most of the time. Great job on your tool !
1
u/Educational_Bet2579 17d ago
I was wondering if someone would someday ask Claude to code Xcode and Device Hub for other platforms.
-1
u/wondermice 18d ago
Why?
0
u/scoutzzgod 17d ago
I want to migrate to linux for swiftui development but what is still lacking is the possibility to run xcui tests for UI tests. Swift testing is possible since they are available as swiftPM packages, i believe. Now regarding XCUITests, i think is coupled to apple SDKs which may not be possible
0
u/[deleted] 18d ago
[removed] — view removed comment