What is the best method for saving macOS application's state?

I am starring with a new macOS application that will have multiple windows. It is not a document based app.


I would like to save the application's state (type of window, position, contents, etc.) when the application quits so that it can open up in exactly the same state when the user launches the app later.


What is the best way of acieving this?