StoreKit Changes for Swift
StoreKit
Removed SKDownloadState.value
Added SKDownload.transaction
Added SKDownloadState.init(rawValue: Int)
Added SKDownloadState.rawValue
Modified SKDownload
| Declaration | |
|---|---|
| From | class SKDownload : NSObject {
var contentIdentifier: String! { get }
var state: SKDownloadState { get }
@NSCopying var contentURL: NSURL! { get }
var progress: Float { get }
@NSCopying var error: NSError! { get }
var timeRemaining: NSTimeInterval { get }
@NSCopying var contentLength: NSNumber! { get }
var contentVersion: String! { get }
class func contentURLForProductID(_ productID: String!) -> NSURL!
class func deleteContentForProductID(_ productID: String!)
} |
| To | class SKDownload : NSObject {
var contentIdentifier: String { get }
var state: SKDownloadState { get }
@NSCopying var contentURL: NSURL? { get }
var progress: Float { get }
@NSCopying var error: NSError? { get }
var timeRemaining: NSTimeInterval { get }
@NSCopying var contentLength: NSNumber { get }
var contentVersion: String? { get }
var transaction: SKPaymentTransaction? { get }
class func contentURLForProductID(_ productID: String) -> NSURL?
class func deleteContentForProductID(_ productID: String)
} |
Modified SKDownload.contentIdentifier
| Declaration | |
|---|---|
| From | var contentIdentifier: String! { get } |
| To | var contentIdentifier: String { get } |
Modified SKDownload.contentLength
| Declaration | |
|---|---|
| From | @NSCopying var contentLength: NSNumber! { get } |
| To | @NSCopying var contentLength: NSNumber { get } |
Modified SKDownload.contentURL
| Declaration | |
|---|---|
| From | @NSCopying var contentURL: NSURL! { get } |
| To | @NSCopying var contentURL: NSURL? { get } |
| Declaration | |
|---|---|
| From | class func contentURLForProductID(_ productID: String!) -> NSURL! |
| To | class func contentURLForProductID(_ productID: String) -> NSURL? |
Modified SKDownload.contentVersion
| Declaration | |
|---|---|
| From | var contentVersion: String! { get } |
| To | var contentVersion: String? { get } |
| Declaration | |
|---|---|
| From | class func deleteContentForProductID(_ productID: String!) |
| To | class func deleteContentForProductID(_ productID: String) |
Modified SKDownload.error
| Declaration | |
|---|---|
| From | @NSCopying var error: NSError! { get } |
| To | @NSCopying var error: NSError? { get } |
Modified SKDownloadState [struct]
| Declaration | Protocols | |
|---|---|---|
| From | struct SKDownloadState {
init(_ value: Int)
var value: Int
} | -- |
| To | struct SKDownloadState : RawRepresentable {
init(_ rawValue: Int)
init(rawValue rawValue: Int)
var rawValue: Int
} | RawRepresentable |
Modified SKMutablePayment
| Declaration | |
|---|---|
| From | class SKMutablePayment : SKPayment {
var productIdentifier: String!
var quantity: Int
@NSCopying var requestData: NSData!
var applicationUsername: String!
} |
| To | class SKMutablePayment : SKPayment {
var productIdentifier: String
var quantity: Int
@NSCopying var requestData: NSData?
var applicationUsername: String?
} |
Modified SKMutablePayment.applicationUsername
| Declaration | |
|---|---|
| From | var applicationUsername: String! |
| To | var applicationUsername: String? |
Modified SKMutablePayment.productIdentifier
| Declaration | |
|---|---|
| From | var productIdentifier: String! |
| To | var productIdentifier: String |
Modified SKMutablePayment.requestData
| Declaration | |
|---|---|
| From | @NSCopying var requestData: NSData! |
| To | @NSCopying var requestData: NSData? |
Modified SKPayment
| Declaration | |
|---|---|
| From | class SKPayment : NSObject, NSCopying, NSMutableCopying {
class func paymentWithProduct(_ product: SKProduct!) -> AnyObject!
var productIdentifier: String! { get }
@NSCopying var requestData: NSData! { get }
var quantity: Int { get }
var applicationUsername: String! { get }
} |
| To | class SKPayment : NSObject, NSCopying, NSMutableCopying {
class func paymentWithProduct(_ product: SKProduct) -> AnyObject
var productIdentifier: String { get }
@NSCopying var requestData: NSData? { get }
var quantity: Int { get }
var applicationUsername: String? { get }
} |
Modified SKPayment.applicationUsername
| Declaration | |
|---|---|
| From | var applicationUsername: String! { get } |
| To | var applicationUsername: String? { get } |
| Declaration | |
|---|---|
| From | class func paymentWithProduct(_ product: SKProduct!) -> AnyObject! |
| To | class func paymentWithProduct(_ product: SKProduct) -> AnyObject |
Modified SKPayment.productIdentifier
| Declaration | |
|---|---|
| From | var productIdentifier: String! { get } |
| To | var productIdentifier: String { get } |
Modified SKPayment.requestData
| Declaration | |
|---|---|
| From | @NSCopying var requestData: NSData! { get } |
| To | @NSCopying var requestData: NSData? { get } |
Modified SKPaymentQueue
| Declaration | |
|---|---|
| From | class SKPaymentQueue : NSObject {
class func defaultQueue() -> SKPaymentQueue!
class func canMakePayments() -> Bool
func addPayment(_ payment: SKPayment!)
func restoreCompletedTransactions()
func restoreCompletedTransactionsWithApplicationUsername(_ username: String!)
func finishTransaction(_ transaction: SKPaymentTransaction!)
func addTransactionObserver(_ observer: SKPaymentTransactionObserver!)
func removeTransactionObserver(_ observer: SKPaymentTransactionObserver!)
var transactions: [AnyObject]! { get }
func startDownloads(_ downloads: [AnyObject]!)
func pauseDownloads(_ downloads: [AnyObject]!)
func resumeDownloads(_ downloads: [AnyObject]!)
func cancelDownloads(_ downloads: [AnyObject]!)
} |
| To | class SKPaymentQueue : NSObject {
class func defaultQueue() -> SKPaymentQueue
class func canMakePayments() -> Bool
func addPayment(_ payment: SKPayment)
func restoreCompletedTransactions()
func restoreCompletedTransactionsWithApplicationUsername(_ username: String?)
func finishTransaction(_ transaction: SKPaymentTransaction)
func addTransactionObserver(_ observer: SKPaymentTransactionObserver)
func removeTransactionObserver(_ observer: SKPaymentTransactionObserver)
var transactions: [SKPaymentTransaction]? { get }
func startDownloads(_ downloads: [SKDownload])
func pauseDownloads(_ downloads: [SKDownload])
func resumeDownloads(_ downloads: [SKDownload])
func cancelDownloads(_ downloads: [SKDownload])
} |
| Declaration | |
|---|---|
| From | func addPayment(_ payment: SKPayment!) |
| To | func addPayment(_ payment: SKPayment) |
| Declaration | |
|---|---|
| From | func addTransactionObserver(_ observer: SKPaymentTransactionObserver!) |
| To | func addTransactionObserver(_ observer: SKPaymentTransactionObserver) |
| Declaration | |
|---|---|
| From | func cancelDownloads(_ downloads: [AnyObject]!) |
| To | func cancelDownloads(_ downloads: [SKDownload]) |
| Declaration | |
|---|---|
| From | class func defaultQueue() -> SKPaymentQueue! |
| To | class func defaultQueue() -> SKPaymentQueue |
| Declaration | |
|---|---|
| From | func finishTransaction(_ transaction: SKPaymentTransaction!) |
| To | func finishTransaction(_ transaction: SKPaymentTransaction) |
| Declaration | |
|---|---|
| From | func pauseDownloads(_ downloads: [AnyObject]!) |
| To | func pauseDownloads(_ downloads: [SKDownload]) |
| Declaration | |
|---|---|
| From | func removeTransactionObserver(_ observer: SKPaymentTransactionObserver!) |
| To | func removeTransactionObserver(_ observer: SKPaymentTransactionObserver) |
| Declaration | |
|---|---|
| From | func restoreCompletedTransactionsWithApplicationUsername(_ username: String!) |
| To | func restoreCompletedTransactionsWithApplicationUsername(_ username: String?) |
| Declaration | |
|---|---|
| From | func resumeDownloads(_ downloads: [AnyObject]!) |
| To | func resumeDownloads(_ downloads: [SKDownload]) |
| Declaration | |
|---|---|
| From | func startDownloads(_ downloads: [AnyObject]!) |
| To | func startDownloads(_ downloads: [SKDownload]) |
Modified SKPaymentQueue.transactions
| Declaration | |
|---|---|
| From | var transactions: [AnyObject]! { get } |
| To | var transactions: [SKPaymentTransaction]? { get } |
Modified SKPaymentTransaction
| Declaration | |
|---|---|
| From | class SKPaymentTransaction : NSObject {
var error: NSError! { get }
var originalTransaction: SKPaymentTransaction! { get }
var payment: SKPayment! { get }
var transactionDate: NSDate! { get }
var transactionIdentifier: String! { get }
var downloads: [AnyObject]! { get }
var transactionState: SKPaymentTransactionState { get }
} |
| To | class SKPaymentTransaction : NSObject {
var error: NSError? { get }
var originalTransaction: SKPaymentTransaction? { get }
var payment: SKPayment { get }
var transactionDate: NSDate? { get }
var transactionIdentifier: String? { get }
var downloads: [AnyObject]? { get }
var transactionState: SKPaymentTransactionState { get }
} |
Modified SKPaymentTransaction.downloads
| Declaration | |
|---|---|
| From | var downloads: [AnyObject]! { get } |
| To | var downloads: [AnyObject]? { get } |
Modified SKPaymentTransaction.error
| Declaration | |
|---|---|
| From | var error: NSError! { get } |
| To | var error: NSError? { get } |
| Declaration | |
|---|---|
| From | var originalTransaction: SKPaymentTransaction! { get } |
| To | var originalTransaction: SKPaymentTransaction? { get } |
Modified SKPaymentTransaction.payment
| Declaration | |
|---|---|
| From | var payment: SKPayment! { get } |
| To | var payment: SKPayment { get } |
Modified SKPaymentTransaction.transactionDate
| Declaration | |
|---|---|
| From | var transactionDate: NSDate! { get } |
| To | var transactionDate: NSDate? { get } |
| Declaration | |
|---|---|
| From | var transactionIdentifier: String! { get } |
| To | var transactionIdentifier: String? { get } |
Modified SKPaymentTransactionObserver
| Declaration | |
|---|---|
| From | protocol SKPaymentTransactionObserver : NSObjectProtocol {
func paymentQueue(_ queue: SKPaymentQueue!, updatedTransactions transactions: [AnyObject]!)
optional func paymentQueue(_ queue: SKPaymentQueue!, removedTransactions transactions: [AnyObject]!)
optional func paymentQueue(_ queue: SKPaymentQueue!, restoreCompletedTransactionsFailedWithError error: NSError!)
optional func paymentQueueRestoreCompletedTransactionsFinished(_ queue: SKPaymentQueue!)
optional func paymentQueue(_ queue: SKPaymentQueue!, updatedDownloads downloads: [AnyObject]!)
} |
| To | protocol SKPaymentTransactionObserver : NSObjectProtocol {
func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction])
optional func paymentQueue(_ queue: SKPaymentQueue, removedTransactions transactions: [SKPaymentTransaction])
optional func paymentQueue(_ queue: SKPaymentQueue, restoreCompletedTransactionsFailedWithError error: NSError)
optional func paymentQueueRestoreCompletedTransactionsFinished(_ queue: SKPaymentQueue)
optional func paymentQueue(_ queue: SKPaymentQueue, updatedDownloads downloads: [SKDownload])
} |
| Declaration | Introduction | |
|---|---|---|
| From | optional func paymentQueue(_ queue: SKPaymentQueue!, removedTransactions transactions: [AnyObject]!) | OS X 10.10 |
| To | optional func paymentQueue(_ queue: SKPaymentQueue, removedTransactions transactions: [SKPaymentTransaction]) | OS X 10.7 |
| Declaration | Introduction | |
|---|---|---|
| From | optional func paymentQueue(_ queue: SKPaymentQueue!, restoreCompletedTransactionsFailedWithError error: NSError!) | OS X 10.10 |
| To | optional func paymentQueue(_ queue: SKPaymentQueue, restoreCompletedTransactionsFailedWithError error: NSError) | OS X 10.7 |
Modified SKPaymentTransactionObserver.paymentQueue(_: SKPaymentQueue, updatedDownloads: [SKDownload])
| Declaration | Introduction | |
|---|---|---|
| From | optional func paymentQueue(_ queue: SKPaymentQueue!, updatedDownloads downloads: [AnyObject]!) | OS X 10.10 |
| To | optional func paymentQueue(_ queue: SKPaymentQueue, updatedDownloads downloads: [SKDownload]) | OS X 10.8 |
| Declaration | Introduction | |
|---|---|---|
| From | func paymentQueue(_ queue: SKPaymentQueue!, updatedTransactions transactions: [AnyObject]!) | OS X 10.10 |
| To | func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) | OS X 10.7 |
Modified SKPaymentTransactionObserver.paymentQueueRestoreCompletedTransactionsFinished(_: SKPaymentQueue)
| Declaration | Introduction | |
|---|---|---|
| From | optional func paymentQueueRestoreCompletedTransactionsFinished(_ queue: SKPaymentQueue!) | OS X 10.10 |
| To | optional func paymentQueueRestoreCompletedTransactionsFinished(_ queue: SKPaymentQueue) | OS X 10.7 |
Modified SKProduct
| Declaration | |
|---|---|
| From | class SKProduct : NSObject {
var localizedDescription: String! { get }
var localizedTitle: String! { get }
var price: NSDecimalNumber! { get }
var priceLocale: NSLocale! { get }
var productIdentifier: String! { get }
var downloadable: Bool { get }
var contentVersion: String! { get }
var contentLengths: [AnyObject]! { get }
} |
| To | class SKProduct : NSObject {
var localizedDescription: String? { get }
var localizedTitle: String? { get }
var price: NSDecimalNumber? { get }
var priceLocale: NSLocale? { get }
var productIdentifier: String? { get }
var downloadable: Bool { get }
var contentVersion: String? { get }
var contentLengths: [NSNumber]? { get }
} |
Modified SKProduct.contentLengths
| Declaration | |
|---|---|
| From | var contentLengths: [AnyObject]! { get } |
| To | var contentLengths: [NSNumber]? { get } |
Modified SKProduct.contentVersion
| Declaration | |
|---|---|
| From | var contentVersion: String! { get } |
| To | var contentVersion: String? { get } |
Modified SKProduct.localizedDescription
| Declaration | |
|---|---|
| From | var localizedDescription: String! { get } |
| To | var localizedDescription: String? { get } |
Modified SKProduct.localizedTitle
| Declaration | |
|---|---|
| From | var localizedTitle: String! { get } |
| To | var localizedTitle: String? { get } |
Modified SKProduct.price
| Declaration | |
|---|---|
| From | var price: NSDecimalNumber! { get } |
| To | var price: NSDecimalNumber? { get } |
Modified SKProduct.priceLocale
| Declaration | |
|---|---|
| From | var priceLocale: NSLocale! { get } |
| To | var priceLocale: NSLocale? { get } |
Modified SKProduct.productIdentifier
| Declaration | |
|---|---|
| From | var productIdentifier: String! { get } |
| To | var productIdentifier: String? { get } |
Modified SKProductsRequest
| Declaration | |
|---|---|
| From | class SKProductsRequest : SKRequest {
init!(productIdentifiers productIdentifiers: Set<NSObject>!)
unowned(unsafe) var delegate: SKProductsRequestDelegate!
} |
| To | class SKProductsRequest : SKRequest {
init(productIdentifiers productIdentifiers: Set<NSObject>)
unowned(unsafe) var delegate: SKProductsRequestDelegate?
} |
Modified SKProductsRequest.delegate
| Declaration | |
|---|---|
| From | unowned(unsafe) var delegate: SKProductsRequestDelegate! |
| To | unowned(unsafe) var delegate: SKProductsRequestDelegate? |
| Declaration | |
|---|---|
| From | init!(productIdentifiers productIdentifiers: Set<NSObject>!) |
| To | init(productIdentifiers productIdentifiers: Set<NSObject>) |
Modified SKProductsRequestDelegate
| Declaration | |
|---|---|
| From | protocol SKProductsRequestDelegate : SKRequestDelegate, NSObjectProtocol {
func productsRequest(_ request: SKProductsRequest!, didReceiveResponse response: SKProductsResponse!)
} |
| To | protocol SKProductsRequestDelegate : SKRequestDelegate, NSObjectProtocol {
func productsRequest(_ request: SKProductsRequest, didReceiveResponse response: SKProductsResponse)
} |
| Declaration | Introduction | |
|---|---|---|
| From | func productsRequest(_ request: SKProductsRequest!, didReceiveResponse response: SKProductsResponse!) | OS X 10.10 |
| To | func productsRequest(_ request: SKProductsRequest, didReceiveResponse response: SKProductsResponse) | OS X 10.7 |
Modified SKProductsResponse
| Declaration | |
|---|---|
| From | class SKProductsResponse : NSObject {
var products: [AnyObject]! { get }
var invalidProductIdentifiers: [AnyObject]! { get }
} |
| To | class SKProductsResponse : NSObject {
var products: [SKProduct]? { get }
var invalidProductIdentifiers: [String]? { get }
} |
| Declaration | |
|---|---|
| From | var invalidProductIdentifiers: [AnyObject]! { get } |
| To | var invalidProductIdentifiers: [String]? { get } |
Modified SKProductsResponse.products
| Declaration | |
|---|---|
| From | var products: [AnyObject]! { get } |
| To | var products: [SKProduct]? { get } |
Modified SKReceiptRefreshRequest
| Declaration | |
|---|---|
| From | class SKReceiptRefreshRequest : SKRequest {
init!(receiptProperties properties: [NSObject : AnyObject]!)
var receiptProperties: [NSObject : AnyObject]! { get }
} |
| To | class SKReceiptRefreshRequest : SKRequest {
init?(receiptProperties properties: [String : AnyObject])
var receiptProperties: [String : AnyObject]? { get }
} |
| Declaration | |
|---|---|
| From | init!(receiptProperties properties: [NSObject : AnyObject]!) |
| To | init?(receiptProperties properties: [String : AnyObject]) |
| Declaration | |
|---|---|
| From | var receiptProperties: [NSObject : AnyObject]! { get } |
| To | var receiptProperties: [String : AnyObject]? { get } |
Modified SKRequest
| Declaration | |
|---|---|
| From | class SKRequest : NSObject {
unowned(unsafe) var delegate: SKRequestDelegate!
func cancel()
func start()
} |
| To | class SKRequest : NSObject {
unowned(unsafe) var delegate: SKRequestDelegate?
func cancel()
func start()
} |
Modified SKRequest.delegate
| Declaration | |
|---|---|
| From | unowned(unsafe) var delegate: SKRequestDelegate! |
| To | unowned(unsafe) var delegate: SKRequestDelegate? |
Modified SKRequestDelegate
| Declaration | |
|---|---|
| From | protocol SKRequestDelegate : NSObjectProtocol {
optional func requestDidFinish(_ request: SKRequest!)
optional func request(_ request: SKRequest!, didFailWithError error: NSError!)
} |
| To | protocol SKRequestDelegate : NSObjectProtocol {
optional func requestDidFinish(_ request: SKRequest)
optional func request(_ request: SKRequest, didFailWithError error: NSError?)
} |
| Declaration | Introduction | |
|---|---|---|
| From | optional func request(_ request: SKRequest!, didFailWithError error: NSError!) | OS X 10.10 |
| To | optional func request(_ request: SKRequest, didFailWithError error: NSError?) | OS X 10.7 |
| Declaration | Introduction | |
|---|---|---|
| From | optional func requestDidFinish(_ request: SKRequest!) | OS X 10.10 |
| To | optional func requestDidFinish(_ request: SKRequest) | OS X 10.7 |