Is the SwiftUI Preview Automatically Getting Paused? Here’s How to Fix It | by Marina Gornostaeva | Feb, 2022

Understand why SwiftUI previews keep getting paused and how to improve the situation

Marina Gornostaeva
struct MyStruct {
dynamic func x() {
print("x")
}
}

extension SettingsRoute {
@_dynamicReplacement(for: x())
func y() {
print("y - replaced dynamically")
}
}

var color = Color.red // change to Color.green, previews are paused
var color: Color { Color.red }
touch ~/scripts/cmd_opt_p.sh
chmod +x ~/scripts/cmd_opt_p.sh
open ~/scripts/cmd_opt_p.sh #edit with your favorite editor
#!/bin/sh
osascript -e 'tell application "System Events" to keystroke "p" using {command down, option down}'

Leave a Comment