When I click the following button on the top of a preview phone, Xcode copies the preview phone for me. So if there is only one preview phone before clicking the button, there are two afterward.
My question is: How to remove the copied preview phone?
CodePudding user response:
Previews only happen because your code says they should happen. All this button really does is to modify the code that generates the preview(s). For example:
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
Group {
ContentView()
ContentView()
}
}
}
See how it says ContentView()
twice? That's two previews. To remove the second preview, revert the change. For example:
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}