title: Custom class objects might be null. How can I tell my initializer this?
body: <p>I have a class I made that I fill with some JSON data.  A couple properties in the class MIGHT be null in some cases.  I thought I prepared for this but when I try to access the class and one of the properties are null I get an error <code>unexpectedly found nil while unwrapping an Optional value</code>.  This error only pops if the value of one of the properties is null.  Here's my class:</p>
  
  <pre><code>class Inventory {
      private var _id, _quantityOnHand: Int!;
      private var _item, _description: String!;
      private var _supplierId: Int?;
      private var _supplierName: String?;
  
      var id: Int {
          get {
              return _id;
          }
      }
  
      var item: String {
          get {
              return _item;
          }
      }
  
      //    ... removed for brevity
  
      var supplierId: Int {
          get {
              return _supplierId!;
          }
      }
  
      var supplierName: String {
          get {
              return _supplierName!;  //this is where error is when value is null
          }
      }
  
      init(id: Int, item: String, description: String, quantityOnHand: Int, supplierId: Int?, supplierName: String?) {
          _id = id;
          _item = item;
          _description = description;
          _quantityOnHand = quantityOnHand;
          _supplierId = supplierId;
          _supplierName = supplierName;
  
      }
  }
  </code></pre>
  
  <p>The fields <code>supplierId</code> and <code>supplierName</code> MIGHT possibly be null (not always though.  When I run my application and it tries to get the value from one of the null properties I get the error.</p>
  
  <p>I tried removing the ! forced unwrapped from my getter but it won't compile and complains about it.</p>
  
  <p>I have a <code>UITableView</code> with a segue the sends the information to the next view controller.  In it I'm putting all the values of the tapped row of the <code>UITableView</code> into variables.  Here's the segue:</p>
  
  <pre><code>override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
          if segue.identifier == "segueToItemDetail" {
              if let destination = segue.destinationViewController as? InventoryItemViewController {
                  if let itemIndex = inventoryListTableView.indexPathForSelectedRow?.row {
                      destination.idInt = warehouseItems[itemIndex].id;
                      destination.itemString = warehouseItems[itemIndex].item;
                      destination.descriptionString
                          = warehouseItems[itemIndex].description;
                      destination.supplierNameString = warehouseItems[itemIndex].supplierName ?? "";
                      destination.quantityOnHandInt = warehouseItems[itemIndex].quantityOnHand;
  
                  }
              }
          }
  </code></pre>
  
  <p>I tried using a Nil Coalescing Operator on the properties that might be null but it still throws the error when trying to pass any values that are null.</p>
  
  <p>Why can't I satiate these optionals?</p>