Embedding NSTokenField inside NSScrollView

In order to get NSTokenField (or NSTextField) play well with a ScrollView, you should:

  1. Pin the fixed edges (in my case: Top / Bottom / Left)
  2. Leave alone the edges that can grow (again, in my case: Right)
  3. Set a placeholder Intrinsic Size, to keep IB happy
  4. Override intrinsicContentSize

Notes:

  • Pinning the TokenField to every single edge simply causes the container view to assume the actual TokenField’s size (and thus, kills the scrolling behavior).
  • Sample code available here!