This repository has been archived by the owner on Mar 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Paywalls: Small fixes and examples for UIKit and modes (#288)
## Motivation / Description Improving docs from questions and examples that were given in beta tester Discord ## Changes introduced - Fixed a variable typo - Added UIKit example to full screen paywall - Added mode examples for SwiftUI and UIKit ## Jira ticket (if any) N/A ## Additional comments N/A
- Loading branch information
1 parent
0748088
commit 12e895d
Showing
7 changed files
with
151 additions
and
5 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
code_blocks/🚀 Getting Started/displaying-products/paywalls/paywalls_1.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,3 +1,6 @@ | ||
import SwiftUI | ||
|
||
import RevenueCat | ||
import RevenueCatUI | ||
|
||
struct App: View { | ||
|
3 changes: 3 additions & 0 deletions
3
code_blocks/🚀 Getting Started/displaying-products/paywalls/paywalls_2.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,3 +1,6 @@ | ||
import SwiftUI | ||
|
||
import RevenueCat | ||
import RevenueCatUI | ||
|
||
struct App: View { | ||
|
3 changes: 3 additions & 0 deletions
3
code_blocks/🚀 Getting Started/displaying-products/paywalls/paywalls_3.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,3 +1,6 @@ | ||
import SwiftUI | ||
|
||
import RevenueCat | ||
import RevenueCatUI | ||
|
||
struct App: View { | ||
|
27 changes: 27 additions & 0 deletions
27
code_blocks/🚀 Getting Started/displaying-products/paywalls/paywalls_4.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,27 @@ | ||
import UIKit | ||
|
||
import RevenueCat | ||
import RevenueCatUI | ||
|
||
class ViewController: UIViewController { | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
} | ||
|
||
@IBAction func presentPaywall() { | ||
let controller = PaywallViewController() | ||
controller.delegate = self | ||
|
||
present(controller, animated: true, completion: nil) | ||
} | ||
} | ||
|
||
extension ViewController: PaywallViewControllerDelegate { | ||
|
||
func paywallViewController(_ controller: PaywallViewController, | ||
didFinishPurchasingWith customerInfo: CustomerInfo) { | ||
|
||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
code_blocks/🚀 Getting Started/displaying-products/paywalls/paywalls_5.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,27 @@ | ||
import SwiftUI | ||
|
||
import RevenueCat | ||
import RevenueCatUI | ||
|
||
struct App: View { | ||
|
||
var body: some View { | ||
VStack { | ||
ScrollView { | ||
VStack { | ||
// Your custom paywall design content | ||
}.frame(maxWidth: .infinity) | ||
} | ||
|
||
Spacer() | ||
|
||
PaywallView(mode: .condensedCard) // or .card | ||
} | ||
.frame(maxWidth: .infinity, maxHeight: .infinity) | ||
.background( | ||
Color(white: 0.8) | ||
.edgesIgnoringSafeArea(.all) | ||
) | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
code_blocks/🚀 Getting Started/displaying-products/paywalls/paywalls_6.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,30 @@ | ||
import UIKit | ||
|
||
import RevenueCat | ||
import RevenueCatUI | ||
|
||
class ViewController: UIViewController { | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
let paywallView = PaywallView(mode: .condensedCard) // or .card | ||
paywall.delegate = self | ||
|
||
let hostingController = UIHostingController(rootView: paywallView) | ||
|
||
addChild(hostingController) | ||
view.addSubview(hostingController.view) | ||
hostingController.didMove(toParent: self) | ||
} | ||
|
||
} | ||
|
||
extension ViewController: PaywallViewControllerDelegate { | ||
|
||
func paywallViewController(_ controller: PaywallViewController, | ||
didFinishPurchasingWith customerInfo: CustomerInfo) { | ||
|
||
} | ||
|
||
} |
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