title: UIView in a ViewController using swift
body: <p>I have a custom view (.xib and .swift) and I want to use it in different ViewControllers and as a custom cellview.
  the thing is I don't know how to do this :P. can anyone please help me out on how to accomplish this?</p>
  
  <p>my custom view is RestaurantVie, I have labels and images:
  `
  class RestaurantView: UIView {</p>
  
  <pre><code>@IBOutlet var view: UIView!
  
  @IBOutlet weak var imgLogo: UIImageView!
  @IBOutlet weak var imgRating: UIImageView!
  
  @IBOutlet weak var lblName: UILabel!
  @IBOutlet weak var lblComments: UILabel!
  @IBOutlet weak var lblMinimumOrder: UILabel!
  @IBOutlet weak var lblDeliveryCost: UILabel!
  @IBOutlet weak var lblStatus: UILabel!
  
  /*
  // Only override drawRect: if you perform custom drawing.
  // An empty implementation adversely affects performance during animation.
  override func drawRect(rect: CGRect)
  {
      // Drawing code
  }
  */
  </code></pre>
  
  <p>}
  `</p>
  
  <p>I want to put that in a RestaurantViewcontroller:</p>
  
  <p>`
  class RestaurantViewController: UIViewController {</p>
  
  <pre><code>@IBOutlet weak var restaurant: RestaurantView!
  
  override func viewDidLoad() {
      super.viewDidLoad()
      let subviewArray = NSBundle.mainBundle().loadNibNamed("RestaurantView", owner: self, options: nil)
      let filtersView : RestaurantView = subviewArray[0] as RestaurantView
      self.view.addSubview(filtersView)
  
      // Do any additional setup after loading the view.
  }
  </code></pre>
  
  <p>`</p>
  
  <p>But when I run the app, it crashes. showing the message: </p>
  
  <p><strong>* Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key imgLogo.'
  *</strong> First throw call stack: </p>
  
  <p>etc....</p>