-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support to allow all subs from all groups to be displayed
- Loading branch information
1 parent
f1ef01f
commit 8e32c9b
Showing
28 changed files
with
323 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
Sources/SKHelper/Documentation.docc/Resources/code/quickstart-app1.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
// | ||
// SKHelperDemoApp.swift | ||
// SKHelperDemo | ||
// | ||
|
||
import SwiftUI | ||
import SKHelper | ||
|
||
|
5 changes: 0 additions & 5 deletions
5
Sources/SKHelper/Documentation.docc/Resources/code/quickstart-contentview1.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
// | ||
// ContentView.swift | ||
// SKHelperDemo | ||
// | ||
|
||
import SwiftUI | ||
import SKHelper | ||
|
||
|
5 changes: 0 additions & 5 deletions
5
Sources/SKHelper/Documentation.docc/Resources/code/quickstart-contentview2.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
// | ||
// ContentView.swift | ||
// SKHelperDemo | ||
// | ||
|
||
import SwiftUI | ||
import SKHelper | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
Sources/SKHelper/Documentation.docc/Resources/code/quickstart-contentview5.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import SwiftUI | ||
import SKHelper | ||
|
||
struct ContentView: View { | ||
@Environment(SKHelper.self) private var store | ||
|
||
var body: some View { | ||
NavigationStack { | ||
List { | ||
: | ||
: | ||
|
||
// Show all purchases the user has made. | ||
NavigationLink("List all purchases") { | ||
SKHelperPurchasesView() | ||
} | ||
} | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
Sources/SKHelper/Documentation.docc/Resources/code/quickstart-contentview6.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import SwiftUI | ||
import SKHelper | ||
|
||
struct ContentView: View { | ||
@Environment(SKHelper.self) private var store | ||
|
||
var body: some View { | ||
NavigationStack { | ||
List { | ||
: | ||
: | ||
|
||
// Show the small flowers purchase-related view | ||
NavigationLink("Access Small Flowers") { | ||
SmallFlowersView() | ||
} | ||
} | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
Sources/SKHelper/Documentation.docc/Resources/code/quickstart-flowers1.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import SwiftUI | ||
import SKHelper | ||
|
||
struct SmallFlowersView: View { | ||
@Environment(SKHelper.self) private var store | ||
@State private var isPurchased = false | ||
private let smallFlowersProductId = "com.rarcher.nonconsumable.flowers.small" | ||
|
||
var body: some View { | ||
VStack { | ||
if isPurchased { FullAccess() } | ||
else { NoAccess() } | ||
} | ||
.task { isPurchased = await store.isPurchased(productId: smallFlowersProductId) } | ||
} | ||
|
||
func FullAccess() -> some View { | ||
VStack { | ||
Text("🥰 🌹").font(.system(size: 100)).padding() | ||
Text("You've purchased the small flowers - here they are, enjoy!").padding() | ||
Image(smallFlowersProductId).resizable().scaledToFit() | ||
} | ||
.padding() | ||
} | ||
|
||
func NoAccess() -> some View { | ||
VStack { | ||
Text("😢").font(.system(size: 100)).padding() | ||
Text("You haven't purchased the small flowers and don't have access.").padding() | ||
ProductNavLink() | ||
Spacer() | ||
} | ||
.padding() | ||
} | ||
|
||
func ProductNavLink() -> some View { | ||
NavigationLink("Review Small Flowers Info") { | ||
SKHelperStoreView(productIds: [smallFlowersProductId]) { productId in | ||
Group { | ||
Image(productId + ".info").resizable().scaledToFit() | ||
Text("Here is some text about why you might want to buy this product.") | ||
} | ||
.padding() | ||
} | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
Sources/SKHelper/Documentation.docc/Resources/code/quickstart-flowers2.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import SwiftUI | ||
import SKHelper | ||
|
||
struct SmallFlowersView: View { | ||
@Environment(SKHelper.self) private var store | ||
@State private var isPurchased = false | ||
private let smallFlowersProductId = "com.rarcher.nonconsumable.flowers.small" | ||
|
||
var body: some View { | ||
VStack { | ||
if isPurchased { FullAccess() } | ||
else { NoAccess() } | ||
} | ||
.task { isPurchased = await store.isPurchased(productId: smallFlowersProductId) } | ||
} | ||
|
||
: | ||
: | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+61.8 KB
Sources/SKHelper/Documentation.docc/Resources/images/quickstart29.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 73 additions & 0 deletions
73
Sources/SKHelper/Documentation.docc/quickstart/check-purchase.tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
@Tutorial(time: 5) { | ||
@XcodeRequirement(title: "Xcode 16", destination: "https://developer.apple.com/download/applications/") | ||
|
||
@Intro(title: "Check a purchase") { | ||
Add code to check if the user has purchased a specific product. | ||
} | ||
|
||
@Section(title: "Check a purchase") { | ||
@ContentAndMedia { | ||
In this section add code to check if the user has purchased a specific product. We also review how to grant or deny access to a | ||
purchase-dependent resource. | ||
|
||
@Image(source: "quickstart29.png", alt: "Check a purchase.") | ||
} | ||
|
||
@Steps { | ||
@Step { | ||
Add the following code at the end of **ContentView.swift** to enable our demo to display a new purchase-dependent | ||
View that we'll create in the next step. | ||
|
||
@Code(name: "ContentView.swift", file: "quickstart-contentview6.swift", previousFile: "quickstart-contentview5.swift", reset: false) {} | ||
} | ||
|
||
@Step { | ||
Create a new SwiftUI and name it **SmallFlowersView**. Replace the contents of the file with the following code. | ||
|
||
@Code(name: "SmallFlowersView.swift", file: "quickstart-flowers1.swift", reset: true) {} | ||
} | ||
|
||
@Step { | ||
Notice how check the purchase status of the small flowers product in a `.task { ... }` before the view is displayed. | ||
We then use the purchase status to grant or deny the user access to the purchase-related resource. | ||
|
||
@Code(name: "SmallFlowersView.swift", file: "quickstart-flowers2.swift", reset: true) {} | ||
} | ||
|
||
@Step { | ||
Build and run the app. For the purposes of this demo we'll assume you haven't yet purchased the small flowers product. | ||
Navigate to the **SmallFlowersView** via the **Access Small Flowers** link. | ||
} | ||
|
||
@Step { | ||
You should see that you've not been granted access to the product. | ||
|
||
@Image(source: "quickstart29.png", alt: "Check a purchase.") | ||
} | ||
|
||
@Step { | ||
Tap the **Review Small Flowers Info** button. You should now see the **SKHelperStoreView** displaying information about the | ||
small flowers product. | ||
|
||
@Image(source: "quickstart30.png", alt: "Check a purchase.") | ||
|
||
Note that by default **SKHelperStoreView** will display a list of all available products. However, in this case we pass the | ||
`ProductId` of the small flowers product which overrides the default behavior. | ||
} | ||
|
||
@Step { | ||
Purchase the small flowers product via the price button displayed on **SKHelperStoreView**. Tap the **Back** button | ||
to navigate back to the **SmallFlowersView**. You should now see that you have been granted access. | ||
|
||
@Image(source: "quickstart31.png", alt: "Check a purchase.") | ||
} | ||
|
||
This concludes the **Quick Start** tutorial, but we've only scratched the surface of what you can do with **StoreKit** and **SKHelper**. | ||
Explore more resources for learning about `SKHelper`. | ||
|
||
- [Documentation landing page](https://russell-archer.github.io/SKHelper/documentation/skhelper) | ||
- [In-depth guide to in-app purchases and **SKHelper**](https://russell-archer.github.io/SKHelper/documentation/skhelper/guide) | ||
- [SKHelperDemo Xcode project](https://github.com/russell-archer/SKHelperDemo) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.