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"))
}
}
You need to specify full designated name, like below (because there is 1st generation also)
ContentView().previewDevice("iPhone SE (2nd generation)")
the full list can be viewed in in Terminal as
$ xcrun simctl list devicetypes