title: How do I use the isActive function throughout my application?
body: <p>I created subscriptions and I created an isActive function to know if the subscription is still valid or not.
  How can I use this function everywhere in my application? for example in an IF.</p>
  <p>thanks</p>
  <pre><code>    import UIKit
      import StoreKit
      
      public typealias SuccessBlock = () -&gt; Void
      public typealias FailureBlock = (Error?) -&gt; Void
      public typealias ProductsBlock = ([SKProduct]) -&gt; Void
      
      let IAP_PRODUCTS_DID_LOAD_NOTIFICATION = Notification.Name(&quot;IAP_PRODUCTS_DID_LOAD_NOTIFICATION&quot;)
      
      class IAPManager : NSObject{
          
          private var sharedSecret = &quot;&quot;
          @objc static let shared = IAPManager()
          @objc private(set) var products = [SKProduct]()
          
          private override init(){}
          private var productIds : Set&lt;String&gt; = []
          
          private var didLoadsProducts : ProductsBlock?
          
          private var successBlock : SuccessBlock?
          private var failureBlock : FailureBlock?
          
          private var refreshSubscriptionSuccessBlock : SuccessBlock?
          private var refreshSubscriptionFailureBlock : FailureBlock?
          
          // MARK:- Main methods
          
          @objc func startWith(arrayOfIds : Set&lt;String&gt;!, sharedSecret : String, callback : @escaping  ProductsBlock){
              SKPaymentQueue.default().add(self)
              self.didLoadsProducts = callback
              self.sharedSecret = sharedSecret
              self.productIds = arrayOfIds
              loadProducts()
          }
          
          func expirationDateFor(_ identifier : String) -&gt; Date?{
              return UserDefaults.standard.object(forKey: identifier) as? Date
          }
          
          func isActive(product : SKProduct) -&gt; Bool {
              if let date = expirationDateFor(product.productIdentifier), Date() &lt; date {
                  return true
              } else {
                  return false
              }
          }
  }
  </code></pre>