(Note there is a bit more than just setting the initial size) For example, if you just set the initial size, resize the view, close the document then reopen the size change will be lost) I spent too much time trying to make it work in MacOS 11.0 ( that's a requirement) The task is very basic Save the application position and size when closing it and restore when opening it again. Saving the actual data is pretty straightforward but setting the first view size appeared to be harder. Here is a mock up application, which always starts with the same size and position. How do I make it behave like a well designed application i.e. it should remember its size between closing and opening documents, and between application launches "
import SwiftUI
@main
struct MyApp: App {
var body: some Scene {
DocumentScene()
}
}
struct DocumentScene: Scene {
@State var t = "123"
var body: some Scene {
DocumentGroup(newDocument: V_WorkflowDocument()) {
file in
GeometryReader{
geometry in
TextEditor(text: $t)
}
}
}
}