File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed
Sources/StoreKitPlus/Products Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change 55// Created by Daniel Saidi on 2024-12-04.
66//
77
8- import SwiftUI
8+ import StoreKit
99
10+ /// This struct is a basic prroduct representation, that you
11+ /// can use to define your products with just an ID and name.
12+ ///
13+ /// The ``StoreContext`` is extended with more ways to fetch
14+ /// product information for a basic product.
1015public struct BasicProduct : Identifiable , ProductRepresentable {
1116
12- /// Create a new product.
17+ /// Create a basic product representation .
1318 ///
1419 /// - Parameters:
1520 /// - id: The App Store string ID of the product.
@@ -26,6 +31,19 @@ public struct BasicProduct: Identifiable, ProductRepresentable {
2631 public let name : String
2732}
2833
34+ public extension StoreContext {
35+
36+ /// Whether a certain basic product is purchased.
37+ func isProductPurchased( _ prod: BasicProduct ) -> Bool {
38+ isProductPurchased ( id: prod. id)
39+ }
40+
41+ /// Get a StoreKit product for a certain basic product.
42+ func product( _ prod: BasicProduct ) -> Product ? {
43+ product ( withId: prod. id)
44+ }
45+ }
46+
2947public extension BasicProduct {
3048
3149 static func preview( _ name: String ) -> Self {
You can’t perform that action at this time.
0 commit comments