Documentation Archive Developer
Search

StoreKit Changes for Swift

StoreKit

Modified SKDownload
Declaration
From
class SKDownload : NSObject {
    var downloadState: SKDownloadState { get }
    var contentLength: Int64 { get }
    var contentIdentifier: String! { get }
    var contentURL: NSURL! { get }
    var contentVersion: String! { get }
    var error: NSError! { get }
    var progress: Float { get }
    var timeRemaining: NSTimeInterval { get }
    var transaction: SKPaymentTransaction! { get }
}
To
class SKDownload : NSObject {
    var downloadState: SKDownloadState { get }
    var contentLength: Int64 { get }
    var contentIdentifier: String { get }
    var contentURL: NSURL? { get }
    var contentVersion: String { get }
    var error: NSError? { get }
    var progress: Float { get }
    var timeRemaining: NSTimeInterval { get }
    var transaction: SKPaymentTransaction { get }
}

Declaration
From
var contentIdentifier: String! { get }
To
var contentIdentifier: String { get }

Declaration
From
var contentURL: NSURL! { get }
To
var contentURL: NSURL? { get }

Declaration
From
var contentVersion: String! { get }
To
var contentVersion: String { get }

Declaration
From
var error: NSError! { get }
To
var error: NSError? { get }

Declaration
From
var transaction: SKPaymentTransaction! { get }
To
var transaction: SKPaymentTransaction { get }

Raw Value Type
From--
ToInt

Declaration
From
class SKMutablePayment : SKPayment {
    var applicationUsername: String!
    var productIdentifier: String!
    var quantity: Int
    @NSCopying var requestData: NSData!
    var simulatesAskToBuyInSandbox: Bool
}
To
class SKMutablePayment : SKPayment {
    var applicationUsername: String
    var productIdentifier: String
    var quantity: Int
    @NSCopying var requestData: NSData?
    var simulatesAskToBuyInSandbox: Bool
}

Declaration
From
var applicationUsername: String!
To
var applicationUsername: String

Declaration
From
var productIdentifier: String!
To
var productIdentifier: String

Declaration
From
@NSCopying var requestData: NSData!
To
@NSCopying var requestData: NSData?

Modified SKPayment
Declaration
From
class SKPayment : NSObject, NSCopying, NSMutableCopying {
    convenience init!(product product: SKProduct!)
    class func paymentWithProduct(_ product: SKProduct!) -> Self!
    class func paymentWithProductIdentifier(_ identifier: String!) -> AnyObject!
    var productIdentifier: String! { get }
    @NSCopying var requestData: NSData! { get }
    var quantity: Int { get }
    var applicationUsername: String! { get }
    var simulatesAskToBuyInSandbox: Bool { get }
}
To
class SKPayment : NSObject, NSCopying, NSMutableCopying {
    convenience init(product product: SKProduct)
    class func paymentWithProduct(_ product: SKProduct) -> Self
    class func paymentWithProductIdentifier(_ identifier: String) -> AnyObject
    var productIdentifier: String { get }
    @NSCopying var requestData: NSData? { get }
    var quantity: Int { get }
    var applicationUsername: String? { get }
    var simulatesAskToBuyInSandbox: Bool { get }
}

Declaration
From
var applicationUsername: String! { get }
To
var applicationUsername: String? { get }

Declaration
From
convenience init!(product product: SKProduct!)
To
convenience init(product product: SKProduct)

Declaration
From
var productIdentifier: String! { get }
To
var productIdentifier: String { get }

Declaration
From
@NSCopying var requestData: NSData! { get }
To
@NSCopying var requestData: NSData? { get }

Declaration
From
class SKPaymentQueue : NSObject {
    class func defaultQueue() -> Self!
    class func canMakePayments() -> Bool
    func addPayment(_ payment: SKPayment!)
    func restoreCompletedTransactions()
    func restoreCompletedTransactionsWithApplicationUsername(_ username: String!)
    func finishTransaction(_ transaction: SKPaymentTransaction!)
    func startDownloads(_ downloads: [AnyObject]!)
    func pauseDownloads(_ downloads: [AnyObject]!)
    func resumeDownloads(_ downloads: [AnyObject]!)
    func cancelDownloads(_ downloads: [AnyObject]!)
    func addTransactionObserver(_ observer: SKPaymentTransactionObserver!)
    func removeTransactionObserver(_ observer: SKPaymentTransactionObserver!)
    var transactions: [AnyObject]! { get }
}
To
class SKPaymentQueue : NSObject {
    class func defaultQueue() -> Self
    class func canMakePayments() -> Bool
    func addPayment(_ payment: SKPayment)
    func restoreCompletedTransactions()
    func restoreCompletedTransactionsWithApplicationUsername(_ username: String?)
    func finishTransaction(_ transaction: SKPaymentTransaction)
    func startDownloads(_ downloads: [SKDownload])
    func pauseDownloads(_ downloads: [SKDownload])
    func resumeDownloads(_ downloads: [SKDownload])
    func cancelDownloads(_ downloads: [SKDownload])
    func addTransactionObserver(_ observer: SKPaymentTransactionObserver)
    func removeTransactionObserver(_ observer: SKPaymentTransactionObserver)
    var transactions: [SKPaymentTransaction] { get }
}

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() -> Self!
To
class func defaultQueue() -> Self

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])

Declaration
From
var transactions: [AnyObject]! { get }
To
var transactions: [SKPaymentTransaction] { get }

Declaration
From
class SKPaymentTransaction : NSObject {
    var error: NSError! { get }
    var originalTransaction: SKPaymentTransaction! { get }
    var payment: SKPayment! { get }
    var downloads: [AnyObject]! { get }
    var transactionDate: NSDate! { get }
    var transactionIdentifier: String! { get }
    var transactionReceipt: NSData! { get }
    var transactionState: SKPaymentTransactionState { get }
}
To
class SKPaymentTransaction : NSObject {
    var error: NSError? { get }
    var originalTransaction: SKPaymentTransaction? { get }
    var payment: SKPayment { get }
    var downloads: [SKDownload] { get }
    var transactionDate: NSDate? { get }
    var transactionIdentifier: String? { get }
    var transactionReceipt: NSData? { get }
    var transactionState: SKPaymentTransactionState { get }
}

Declaration
From
var downloads: [AnyObject]! { get }
To
var downloads: [SKDownload] { get }

Declaration
From
var error: NSError! { get }
To
var error: NSError? { get }

Declaration
From
var originalTransaction: SKPaymentTransaction! { get }
To
var originalTransaction: SKPaymentTransaction? { get }

Declaration
From
var payment: SKPayment! { get }
To
var payment: SKPayment { get }

Declaration
From
var transactionDate: NSDate! { get }
To
var transactionDate: NSDate? { get }

Declaration
From
var transactionIdentifier: String! { get }
To
var transactionIdentifier: String? { get }

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
From
optional func paymentQueue(_ queue: SKPaymentQueue!, removedTransactions transactions: [AnyObject]!)
To
optional func paymentQueue(_ queue: SKPaymentQueue, removedTransactions transactions: [SKPaymentTransaction])

Declaration
From
optional func paymentQueue(_ queue: SKPaymentQueue!, restoreCompletedTransactionsFailedWithError error: NSError!)
To
optional func paymentQueue(_ queue: SKPaymentQueue, restoreCompletedTransactionsFailedWithError error: NSError)

Declaration
From
optional func paymentQueue(_ queue: SKPaymentQueue!, updatedDownloads downloads: [AnyObject]!)
To
optional func paymentQueue(_ queue: SKPaymentQueue, updatedDownloads downloads: [SKDownload])

Declaration
From
func paymentQueue(_ queue: SKPaymentQueue!, updatedTransactions transactions: [AnyObject]!)
To
func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction])

Declaration
From
optional func paymentQueueRestoreCompletedTransactionsFinished(_ queue: SKPaymentQueue!)
To
optional func paymentQueueRestoreCompletedTransactionsFinished(_ queue: SKPaymentQueue)

Raw Value Type
From--
ToInt

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 downloadContentLengths: [AnyObject]! { get }
    var downloadContentVersion: String! { 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 downloadContentLengths: [NSNumber] { get }
    var downloadContentVersion: String { get }
}

Declaration
From
var downloadContentLengths: [AnyObject]! { get }
To
var downloadContentLengths: [NSNumber] { get }

Declaration
From
var downloadContentVersion: String! { get }
To
var downloadContentVersion: String { get }

Declaration
From
var localizedDescription: String! { get }
To
var localizedDescription: String { get }

Declaration
From
var localizedTitle: String! { get }
To
var localizedTitle: String { get }

Declaration
From
var price: NSDecimalNumber! { get }
To
var price: NSDecimalNumber { get }

Declaration
From
var priceLocale: NSLocale! { get }
To
var priceLocale: NSLocale { get }

Declaration
From
var productIdentifier: String! { get }
To
var productIdentifier: String { get }

Declaration
From
class SKProductsRequest : SKRequest {
    init!(productIdentifiers productIdentifiers: Set<NSObject>!)
    unowned(unsafe) var delegate: SKProductsRequestDelegate!
}
To
class SKProductsRequest : SKRequest {
    init(productIdentifiers productIdentifiers: Set<String>)
    unowned(unsafe) var delegate: SKProductsRequestDelegate?
}

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<String>)

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
From
func productsRequest(_ request: SKProductsRequest!, didReceiveResponse response: SKProductsResponse!)
To
func productsRequest(_ request: SKProductsRequest, didReceiveResponse response: 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 }

Declaration
From
var products: [AnyObject]! { get }
To
var products: [SKProduct] { get }

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()
}

Declaration
From
unowned(unsafe) var delegate: SKRequestDelegate!
To
unowned(unsafe) var delegate: 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
From
optional func request(_ request: SKRequest!, didFailWithError error: NSError!)
To
optional func request(_ request: SKRequest, didFailWithError error: NSError)

Declaration
From
optional func requestDidFinish(_ request: SKRequest!)
To
optional func requestDidFinish(_ request: SKRequest)

Declaration
From
class SKStoreProductViewController : UIViewController {
    unowned(unsafe) var delegate: SKStoreProductViewControllerDelegate!
    func loadProductWithParameters(_ parameters: [NSObject : AnyObject]!, completionBlock block: ((Bool, NSError!) -> Void)!)
}
To
class SKStoreProductViewController : UIViewController {
    unowned(unsafe) var delegate: SKStoreProductViewControllerDelegate?
    func loadProductWithParameters(_ parameters: [String : AnyObject], completionBlock block: ((Bool, NSError?) -> Void)?)
}

Declaration
From
unowned(unsafe) var delegate: SKStoreProductViewControllerDelegate!
To
unowned(unsafe) var delegate: SKStoreProductViewControllerDelegate?

Declaration
From
func loadProductWithParameters(_ parameters: [NSObject : AnyObject]!, completionBlock block: ((Bool, NSError!) -> Void)!)
To
func loadProductWithParameters(_ parameters: [String : AnyObject], completionBlock block: ((Bool, NSError?) -> Void)?)

Declaration
From
protocol SKStoreProductViewControllerDelegate : NSObjectProtocol {
    optional func productViewControllerDidFinish(_ viewController: SKStoreProductViewController!)
}
To
protocol SKStoreProductViewControllerDelegate : NSObjectProtocol {
    optional func productViewControllerDidFinish(_ viewController: SKStoreProductViewController)
}

Declaration
From
optional func productViewControllerDidFinish(_ viewController: SKStoreProductViewController!)
To
optional func productViewControllerDidFinish(_ viewController: SKStoreProductViewController)