I'm trying to develop an iPhone app using Xcode (Ver. 14.2 for Mac OS Monterey since my Mac is a 2017 model)
Here's the thing:
Even though I start from this template by selecting "Creating new project → App", an image of an iPhone does not appear in Preview/ Run. As I know, an iPhone is supposed to be there. But only objects are working without an iPhone frame as follows.
And this is what's happening when I "run" the same code.
What's wrong with my Xcode? Please let me know how to make an image of an iPhone appear
FYI, Here is the code
ContentView
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundColor(.accentColor)
Text("Hello, world!")
}
.padding()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
HelloApp
import SwiftUI
@main
struct HelloApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
Change the target device
At the center top click on “My Mac” and change it to an iPhone.
If an iPhone option isn’t available you need to make sure you have an iPhone as a selected platform in the General tab for the project.