save more data permanently

Discussion in 'iOS Programming' started by sgs1, Jun 22, 2016.

  1. sgs1 macrumors newbie

    Jul 14, 2014

    I've a problem with the developing of an app. My app list many products, so when i press on the product's image, i see a view with the details of the product, where the user can select the quantity.

    Now: Before the final page (where i send an email to the shopper) i would like to implement a summary page, where i can see the products that i've chosen, with price and quantity.
    So, how i can "save" that preferences so i can display them in summary view?

    Thank you!
  2. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    Mobile apps normally have a Model View Controller design. (Look that up if you don't know what it is.) The data model for your app could have a shopping cart class. The shopping cart is probably a singleton. It might have an array of items that have been selected for purchase. The shopping cart is part of the Model layer and is separate from the UI of your app. When the user gets to the summary screen just show the items in the shopping cart.

    If you want to persist the shopping cart a simple way would be to write a plist file of the shopping cart list of items. More complicated would be to use core data or sqlite directly.

Share This Page