فهرست منبع

Merge pull request #14 from garnett/no-breaks

Remove unnecessary break statements
Andrea Bizzotto 9 سال پیش
والد
کامیت
5f604d9c87
3فایلهای تغییر یافته به همراه0 افزوده شده و 14 حذف شده
  1. 0 9
      README.md
  2. 0 3
      SwiftyStoreKit/InAppProductPurchaseRequest.swift
  3. 0 2
      SwiftyStoreKit/SwiftyStoreKit.swift

+ 0 - 9
README.md

@@ -25,10 +25,8 @@ SwiftyStoreKit.retrieveProductInfo("com.musevisions.SwiftyStoreKit.Purchase1") {
     case .Success(let product):
         let priceString = NSNumberFormatter.localizedStringFromNumber(product.price, numberStyle: .CurrencyStyle)
         print("Product: \(product.localizedDescription), price: \(priceString)")
-        break
     case .Error(let error):
         print("Error: \(error)")
-        break
     }
 }
 ```
@@ -39,10 +37,8 @@ SwiftyStoreKit.purchaseProduct("com.musevisions.SwiftyStoreKit.Purchase1") { res
     switch result {
     case .Success(let productId):
         print("Purchase Success: \(productId)")
-        break
     case .Error(let error):
         print("Purchase Failed: \(error)")
-        break
     }
 }
 ```
@@ -54,13 +50,10 @@ SwiftyStoreKit.restorePurchases() { result in
     switch result {
     case .Success(let productId):
         print("Restore Success: \(productId)")
-        break
     case .NothingToRestore:
         print("Nothing to Restore")
-        break
     case .Error(let error):
         print("Restore Failed: \(error)")
-        break
     }
 }
 ```
@@ -81,10 +74,8 @@ func refreshReceipt() {
         switch result {
         case .Success:
             print("Receipt refresh success")
-            break
         case .Error(let error):
             print("Receipt refresh failed: \(error)")
-            break
         }
     }
 }

+ 0 - 3
SwiftyStoreKit/InAppProductPurchaseRequest.swift

@@ -104,7 +104,6 @@ class InAppProductPurchaseRequest: NSObject, SKPaymentTransactionObserver {
                     self.callback(result: .Purchased(productId: transaction.payment.productIdentifier))
                 })
                 paymentQueue.finishTransaction(transaction)
-                break
             case .Failed:
                 dispatch_async(dispatch_get_main_queue(), {
                     // It appears that in some edge cases transaction.error is nil here. Since returning an associated error is
@@ -113,13 +112,11 @@ class InAppProductPurchaseRequest: NSObject, SKPaymentTransactionObserver {
                     self.callback(result: .Failed(error: transaction.error ?? altError))
                 })
                 paymentQueue.finishTransaction(transaction)
-                break
             case .Restored:
                 dispatch_async(dispatch_get_main_queue(), {
                     self.callback(result: .Restored(productId: transaction.payment.productIdentifier))
                 })
                 paymentQueue.finishTransaction(transaction)
-                break
             case .Purchasing:
                 // In progress: do nothing
                 break

+ 0 - 2
SwiftyStoreKit/SwiftyStoreKit.swift

@@ -154,10 +154,8 @@ public class SwiftyStoreKit {
                 } else {
                     completion(result: .Success)
                 }
-                break
             case .Error(let e):
                 completion(result: .Error(error: e))
-                break
             }
         }
     }