Swift - Touchbar 处理流程

NSTouchBar discovery by the system proceeds as shown from bottom-to-top in this list:

  1. App delegate
  2. App object
  3. Main window’s controller
  4. Main window’s delegate
  5. Main window
  6. Main window’s first responder
  7. Key window’s controller
  8. Key window’s delegate
  9. Key window
  10. Key window’s first responder

Which means it will try to find in the windowcontroller or app delegate.

Refers from: https://stackoverflow.com/questions/42342231/how-to-show-touch-bar-in-a-viewcontroller