Skip to content

Instantly share code, notes, and snippets.

View natefanaro's full-sized avatar

Nate Fanaro natefanaro

View GitHub Profile
@natefanaro
natefanaro / StoreKitUtil.swift
Created February 28, 2020 23:47 — forked from nbasham/StoreKitUtil.swift
Enables creation of SKProduct and SKPaymentTransaction so StoreKit work flow and model can be the same on a simulator as it is on a device.
import StoreKit
public extension SKProduct {
convenience init(d : Dictionary<String, AnyObject>) {
self.init()
self.setValue(d["uid"], forKey: "productIdentifier")
self.setValue(d["title"], forKey: "localizedTitle")
self.setValue(d["detail"], forKey: "localizedDescription")
self.setValue(NSDecimalNumber(string: (d["price"] as! String?)), forKey: "price")