Chapter 7. Creating Views Programmatically
In the last chapter, we used Interface Builder to create a window containing a table view and text field, which we then hooked up to the app's data model using Cocoa Bindings. This is an excellent way to go about constructing user interfaces, since it takes much of the complicated background machinery out of the picture, allowing the developer to focus on the visual aspects of the interface.
In many cases, this method of building is perfectly adequate, and can save a lot of boilerplate code writing, but there are also many occasions in which it is necessary, or at least preferable, to create an interface in code, and this is the topic of this chapter.
In this chapter, you will learn about the following:
- The advantages that coding an interface offers
- Creating and configuring an
NSTableView
and other controls from scratch - Adding a property list to a project and editing its XML data
- Reading data from an app's main bundle
- Wrapping Swift data structures to...