I have a SwiftUI app originally coded for iOS, that I would like to run at mac as well. I have checked Mac in Deployment info section, but the problem is that the app starts in an iPad-sized window that cannot be resized to a smaller size by user.
I would like to
- allow the window to be resized to a smaller than default size
- start the app with a smaller window size (that looks like iPhone app running in a window)
I tried adding frame modifier to ContentView like this, but it didn't accomplish anything:
import SwiftUI
@main
struct MyApp: App {
@Environment(\.scenePhase) var scenePhase
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
@StateObject var appState = AppState()
var body: some Scene {
WindowGroup {
ContentView()
.environmentObject(appState)
// this is an attempt to start the app at 'iPhone-like' size
.frame(minWidth: 320, idealWidth: 400, maxWidth: .infinity, minHeight: 480, idealHeight: 480, maxHeight: .infinity)
}
}
}

