- File > Swift Packages > Add Package Dependency
- Add
https://github.com/GoMarketMe/gomarketme-swift.git
- Select "Exact Version" > "2.1.0"
Using an older version of Xcode? Do this instead:
- Navigate to the project navigator and select your project or the blue project icon.
- Package Dependencies > Add a New Package > +
- In the search bar that appears, enter
https://github.com/GoMarketMe/gomarketme-swift.git
- Press "Add Package"
import GoMarketMe
private let goMarketMe = GoMarketMe.shared
init() {
goMarketMe.initialize(apiKey: "API_KEY") // Initialize with your API key
}
// Step 1: Retrieve the product
// Step 2: Attempt the purchase
// Step 3: Handle the purchase result
switch result {
case .success(let verification):
if case .verified(let transaction) = verification {
// RevenueCat user or don't have access to the transaction?
// Use the following instead: await goMarketMe.syncAllTransactions().
await goMarketMe.syncTransaction(transaction: transaction) // <- add this line for faster processing
}
}
Make sure to replace API_KEY with your actual GoMarketMe API key. You can find it on the onboarding page and under Profile > API Key.
Check out our sample app for an example.