This repository demonstrates how to integrate the Adapty SDK into an existing UIKit-based iOS project. It contains two branches:
starter: A “clean slate” version of the Focus Journal app with no Adapty code included. Use this branch to follow the Quickstart guide and add Adapty yourself.main: The fully integrated version, showing the completed Adapty integration for reference.
Focus Journal is a simple mood journal app that lets users log a daily mood entry and view their history. In the “premium” flow, tapping “History” triggers a paywall if the user is not subscribed. The Adapty SDK is used to:
- Activate Adapty at launch
- Fetch the user’s profile and determine access
- Display a customizable paywall UI
- Handle purchase/restore callbacks
You can follow along on the starter branch to add Adapty manually, or inspect the main branch to see the final result.
-
starter- Contains the Focus Journal Xcode project without any Adapty code.
- Meant as a starting point for readers.
-
main- Contains the same Focus Journal project, but with all Adapty integration steps already applied.
- Compare this branch to
starterto see exactly which files changed and how.
- Xcode 14.0+
- iOS 15.0+ target (you can adjust as needed)
- Swift 5
- A valid Adapty account with an SDK key (visit app.adapty.io/settings to get your SDK key)
-
Clone this repository
git clone https://github.com/ferrousguy/Focus-Journal-iOS-UIKit.git cd focus-journal -
Check out the starter branch
git checkout starter
-
Open the Xcode project
open FocusJournal.xcodeproj
-
Follow the Quickstart Integration Guide to add Adapty step-by-step.
-
When you're done, or if you get stuck, switch to the
mainbranch to compare your work:git checkout main
- git checkout main
- Open FocusJournal.xcodeproj.
- Add your Adapty API key to AppConstants.swift.
- Build & run and you’ll see Adapty initialize itself.
Note: You need the products, placements, and paywalls already defined in your Adapty dashboard. See these docs for help.
You should now have a working Adapty integration in a UIKit-based iOS app. Feel free to explore the main branch to see the complete implementation or continue customizing the UI in HomeViewController.swift and ProfileManager.swift.
If you find any mistakes or have questions, please open an issue or submit a pull request. Happy coding!