Skip to content

Latest commit

 

History

History

MagicWeather

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Magic Weather iOS - RevenueCat Sample

Magic Weather is a sample app demonstrating the proper methods for using RevenueCat's Purchases SDK. This sample uses only native platform components - no third-party SDKs other than the Purchases SDK.

Sign up for a free RevenueCat account here.

Requirements

This sample uses:

  • Xcode 15.3
  • iOS 15
  • Swift 5

See minimum platform version requirements for RevenueCat's Purchases SDK here.

Features

Feature Sample Project Location
🕹 Configuring the Purchases SDK Lifecycle/AppDelegate.swift
💰 Building a basic paywall Controllers/UserViewController.swift
💰 Building a targeted paywall Controllers/WeatherViewController.swift
🔐 Checking subscription status Controllers/WeatherViewController.swift
🤑 Restoring transactions Controllers/UserViewController.swift
👥 Identifying the user Controllers/UserViewController.swift
🚪 Logging out the user Controllers/UserViewController.swift

Setup & Run

Prerequisites

Steps to Run

  1. Download or clone this repository

    git clone https://github.com/RevenueCat/purchases-ios.git

  2. Navigate to the Examples directory and open the file MagicWeather.xcodeproj in Xcode.

  3. On the General tab of the project editor, match the bundle ID to your bundle ID in App Store Connect and RevenueCat.

    General tab in Xcode
  4. On the Signing & Capabilities tab of the project editor, select the correct development team from the Team dropdown.

    Signing & Capabilities tab in Xcode
  5. In the Constants.swift file:

    • Replace the value for apiKey with the API key from your RevenueCat project.
    • Replace the value for entitlementID with the entitlement ID of your product in RevenueCat's dashboard.
    • Comment out the error directives.
  6. Build the app and run it on your device.

Example Flow: Purchasing a Subscription

  1. On the home page, select Change the Weather.
  2. On the prompted payment sheet, select the product listed.
  3. On the next modal, select Subscribe.
  4. On the next modal, sign in with your Sandbox Apple ID.
  5. On the next modal, select Ok.
  6. Return to the home page and select Change the Weather to see the weather change!

Purchase Flow Demo

Support

For more technical resources, check out our documentation.

Looking for RevenueCat Support? Visit our community.