title: Composition vs inheritance for iOS base view controller
body: <p>In general, I've heard its better to use composition than inheritance, but it's not always clear to me how to do that.  I want to create some functionality that's common across all of my view controllers (I want to listen for an NSNotification, and call a method if it receives the notif). </p>
  
  <p>My idea is to create a BaseViewController that each UIViewController extends from.  I'd love to solve this any other way than inheritance for many reasons</p>
  
  <ul>
  <li>Some view controllers extend UIViewController and some extend UITableViewController</li>
  <li>If I write it in swift, objc view controllers can't subclass it</li>
  <li>Normal reasons for comp over inheritance - easier to understand the behavior</li>
  </ul>
  
  <p>My question is - how do I accomplish this without copy and pasting a ton of code into each viewcontroller?  I could obviously insert a line into each view controllers viewDidLoad method, to add a listener, and into each view controllers delloc, but I'd really rather avoid this.  Is there other techniques that could make this cleaner?</p>