onmyway133 / blog

🍁 What you don't know is what you haven't learned
https://onmyway133.com/
MIT License
669 stars 33 forks source link

How to create document based macOS app #875

Open onmyway133 opened 2 years ago

onmyway133 commented 2 years ago

Read newDocument

This method calls openUntitledDocumentAndDisplay(_:).

Read openUntitledDocumentAndDisplay

The default implementation of this method calls defaultType to determine the type of new document to create, calls makeUntitledDocument(ofType:) to create it, then calls addDocument(_:) to record its opening.

Read defaultType

The default implementation of this method returns the first Editor type declared by the CFBundleDocumentTypes array in the application's Info.plist, or returns nil if no Editor type is declared. You can override it to customize the type of document that is created when, for instance, the user chooses New in the File menu.

Read more