working on an app that tracks an item's price. It's setup as a double in core data, and accepts user input into a text field where they'll type the item's price using a decimal pad. here's the code that sets and stores the item price:
if let price = priceField.text {
item.price = (price as NSString).doubleValue
}
what I want to do is set the how the price displays price values. right now if the user types "25.10", the price displays as "$25.1", missing the 0 in the second decimal spot. if the user types "25", the price displays "$25.0" also missing the second decimal spot.
I've tried using a method like what you'd use with a string to set decimal places, but no luck since this is a double.
any suggestions welcome. thanks again for all the help for a novice.