Toolbar is an essential UI component for Mac apps. SwiftUI, as of Xcode 11.4, however, does not provide a Toolbar View. So, what can we do?
In general, in macOS Catalina, SwiftUI provides all the components needed to build UI inside NSWindow’s content view. UI components outside of the content view relies on traditional AppKit to provide support.
Our solution here rides alone this line… We will be adding an NSToolbar object to NSWindow in code.
I’ve seen discussions which recommends using title bar accessory view as solution:
Apple’s Core Data Programming Guide warns you about strong references between managed objects.
with relationships between managed objects, each object maintains a strong reference to the object or objects to which it is related. This relationship can cause strong reference cycles that in turn can cause objects to be held in memory long past their usefulness
This is not super ideal. All the effort we put to avoid memory leaks, to refer object with weak or unowned reference, renders partially useless. As long as we use Core Data, the framework creates retain cycles for us.
(I am not exactly sure why Core Data is designed this way. Object graph maintenance? Certain relationship transversal optimization? Feel free to leave me some clues in the comment…
Keeping track of internal API changes is not always as easy. In the midst of development, when everyone is swamped, well documented, well intended change could still come as a surprise to API user.
To easily keep track of internal API changes, some kind of automated API response monitor will be helpful.
JSON Schema defines the schema of JSON response. We use ajv to validate our schema.
To help get started, I recommend the tutorial on tuts+ where you can find a great introduction to key features of JSON Schema.
On top of what’s mentioned in the article, I have a few extra…