Post

Replies

Boosts

Views

Activity

Reply to Preview of SwitftUI View used in multiple targets
Solution to preview a SwiftUI View for watchOS (Standalone) and iOS: Create a new scheme In the Build Section only add the watchOS Target Run the preview I did not found a solution to display the view for the two targets at the same time (side by side) but at least I can preview it for every target by switching the scheme Using compiler flags you can even customize the previews. For example testing darkMode on iOS or using a different device. Group { MyView(model: viewModel) {} #if os(iOS) MyView(model: viewModel{}. preferredColorScheme(.dark) #endif }
Dec ’21