diff GeoQuiz/GeoQuizApp.swift @ 11:039b26a99a48

implementing RevenueCat
author Dennis C. M. <dennis@denniscm.com>
date Sun, 09 Oct 2022 17:02:34 +0200
parents 413e2d21333e
children ce7ea84f67f5
line wrap: on
line diff
--- a/GeoQuiz/GeoQuizApp.swift	Sat Oct 08 21:36:40 2022 +0200
+++ b/GeoQuiz/GeoQuizApp.swift	Sun Oct 09 17:02:34 2022 +0200
@@ -6,12 +6,28 @@
 //
 
 import SwiftUI
+import RevenueCat
 
 @main
 struct GeoQuizApp: App {
+    
+    init() {
+        Purchases.configure(withAPIKey: "appl_BymTxroeoaWiXAraaFjcPlHlqbf")
+    }
+    
     var body: some Scene {
         WindowGroup {
             ContentView()
+                .onAppear(perform: testRevenueCat)
+        }
+    }
+    
+    private func testRevenueCat() {
+        Purchases.shared.getOfferings { (offerings, error) in
+            if let packages = offerings?.current?.availablePackages {
+                // Display packages for sale
+                print(packages)
+            }
         }
     }
 }