title: save in userdefaults is crashing app
body: <p>I am new to swift and trying to save array into userdefaults and my app is crashing.</p>
  
  <p>I am using below code</p>
  
  <pre><code>let currentObject = productsArray[clickedPosition] as Product
  print("currentObject===\(currentObject)")
  var currentCartArray = [Product]()
  currentCartArray.append(currentObject)
  
  UserDefaults.standard.set(currentCartArray, forKey: "Wafaa_MyCart")
  UserDefaults.standard.synchronize()
  </code></pre>
  
  <p>Below is what I get in output</p>
  
  <pre><code>currentObject===Product(Id: Optional(10007), TitleEN: Optional("PDF 1"), 
                  TitleAR: Optional("PDF 1 AR"), DescriptionEN: nil, 
                  DescriptionAR: nil, AboutEN: Optional("Merchant 1"), 
                  AboutAR: Optional("Merchant 1"), CategoryId: Optional(1), 
                  UnitSold: Optional(0), CategoryEN: Optional("Category 1"), 
                  CategoryAR: Optional("الفئة الأولى"), CountryId: Optional(23), 
                  CountryEN: Optional("Egypt"), CountryAR: Optional("مصر"), 
                  CountryFlag: Optional("http://xxxx.xxxxx.info//Files/CountryPhotos/EG-128.png"),
                   MerchantId: Optional(1), MerchantNameEN: Optional("Merchant 1"), 
                  MerchantNameAR: Optional("Merchant 1"), Logo: Optional(""), 
                  CurrencyId: Optional(1), CurrencyCode: Optional(414), 
                  CurrencyEN: Optional("Kuwaiti Dinar"), CurrencyAR: Optional("دينار كويتى"), 
                  SymbolEN: Optional("KWD"), SymbolAR: Optional("KWD"), 
                  Discount: Optional("0%"), 
                  FinalPrice: Optional("1.000"), Price: Optional("1.000"), 
                  OverViewAR: Optional("ddddddd"), OverViewEN: Optional("dddd"), 
                  NoUsersRate: Optional(0), IsFavorite: Optional(false), 
                  IsPurchased: Optional(false), 
                  FavoriteIds: nil, Rate: Optional(3), 
                  DemoVideo: Optional("http://player.vimeo.com/video/1111"), 
                  VideoDuration: Optional("06:12:00"), ViewersCount: Optional(7), 
                  Photo: Optional("http://xxxx.xxxx.info//Images/noimageicon.png"), 
                  AddedOnDate: Optional("28/02/2018 01:43 PM"))
  </code></pre>
  
  <p>this crash saying below error</p>
  
  <pre><code>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Attempt to insert non-property list object (
  "Wafaa.Product(Id: Optional(10007), TitleEN: Optional(\"PDF 1\"), 
      TitleAR: Optional(\"PDF 1 AR\"), DescriptionEN: nil, DescriptionAR: nil, 
      AboutEN: Optional(\"Merchant 1\"), AboutAR: Optional(\"Merchant 1\"), 
      CategoryId: Optional(1), UnitSold: Optional(0), CategoryEN: Optional(\"Category 1\"), 
      CategoryAR: Optional(\"\U0627\U0644\U0641\U0626\U0629 \U0627\U0644\U0623\U0648\U0644\U0649\"), 
      CountryId: Optional(23), CountryEN: Optional(\"Egypt\"), 
      CountryAR: Optional(\"\U0645\U0635\U0631\"), 
      CountryFlag: Optional(\"http://xxx.xxxx.info//Files/CountryPhotos/EG-128.png\"), 
      MerchantId: Optional(1), MerchantNameEN: Optional(\"Merchant 1\"), 
      MerchantNameAR: Optional(\"Merchant 1\"), Logo: Optional(\"\"), 
      CurrencyId: Optional(1), CurrencyCode: Optional(414), 
      CurrencyEN: Optional(\"Kuwaiti Dinar\"), 
      CurrencyAR: Optional(\"\U062f\U064a\U0646\U0627\U0631 \U0643\U0648\U064a\U062a\U0649\"), 
      SymbolEN: Optional(\"KWD\"), SymbolAR: Optional(\"KWD\"), 
      Discount: Optional(\"0%\"), FinalPrice: Optional(\"1.000\"), 
      Price: Optional(\"1.000\"), OverViewAR: Optional(\"ddddddd\"), 
      OverViewEN: Optional(\"dddd\"), NoUsersRate: Optional(0), 
      IsFavorite: Optional(false), IsPurchased: Optional(false), 
      FavoriteIds: nil, Rate: Optional(3), 
      DemoVideo: Optional(\"http://player.vimeo.com/video/xxxxx\"), VideoDuration: Optional(\"06:12:00\"), 
      ViewersCount: Optional(7), Photo: Optional(\"http://xxxx.xxxx.info//Images/noimageicon.png\"), 
      AddedOnDate: Optional(\"28/02/2018 01:43 PM\"))"
  </code></pre>
  
  <p>I remember, in Objective-C it used to crash only if I have NULL, but here I don't have any null, still why crash is happening?</p>
  
  <p>Any idea where I am going wrong?</p>