I am new to SwiftUI and I was trying to change my preview device to iPhone SE but the device does not change. When I update the text "Hello, world!" to something else in the ContentView, it does show the updated text on the preview device. The device is current the default device provided when I created a new project using SwiftUI. I am currently using Xcode version 12.0.1 and below is my code:
import SwiftUI
struct ContentView: View {
var body: some View {
Text("Hello, world!")
.padding()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
.previewDevice(PreviewDevice(rawValue: "iPhone SE"))
}
}
2
Answers
You need to specify full designated name, like below (because there is 1st generation also)
the full list can be viewed in in Terminal as
All you need to specify designated name given by apple:
To get all names, you may use this DeviceName Custom enum.