In a custom NSView, when building up a list of subviews, it is typical to call the addSubview
function once for each subview. A neater way to do this is to just set the subviews
array directly. The NSView internals are clever enough to do any of the extra book-keeping required, just as if you had called addSubview
each time.
For example:
I like this because it’s a little more concise, and it also reminds me to think about the order of the subviews. Thanks to Jeff Nadeau for pointing this out on Twitter!