Easily Make Money with Apps (SwiftUI RevenueCat Tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
as app developers we ultimately want to make money with our projects and there's no better way to do that than with Revenue cap Revenue cap is a platform that handles in-app purchases on mobile devices it has an intuitive dashboard with analytics and it's super easy to set up I partnered up with Revenue cat for this video to show you exactly how to get started what we're going to do first is build a UI now we're going to make this as simple as possible so that we can get into the revenue cap part but basically we're going to have a tab view with a free part like that anyone can see and a pro part A Pro Tab screen whatever that only Pro users only subscribers can say to begin we're going to start a new xcode project we're just going to name this Revenue cat demo and we're going to use Swift UI hide that so let's set that up now we're going to delete this image and just play with the text and we're going to make this text say everyone can see this screen underneath here we're going to make a button we're going to hit action and label hit enter just add a comment right now that says purchase Pro Plan and then for the label we're going to say text subscribe and then we're going to give it a frame of a width 300 height 50. I'm going to do background ultrasound material in rounded rectangle with a corner radius of 10. so you can see the button now we're going to make a new file Swift UI view we're going to call this Pro View and we're going to make this text say only subscribers can see this text we're going to say blur radius 10. so right now we can't see it we're going to put this in a v stack and then outside of the v-stack we're going to say dot on appear we're going to add a comment that says check subscriber status next you could just do a Google search for like Revenue cat iOS GitHub and then all you're going to do once you're on purchases Dash iOS you're going to copy this URL come back to xcode file add packages paste the URL and then I'm just using the main branch this should be fine this is essentially importing Revenue cat into your project go ahead and check the receipt parser and revenue cap I'm not sure if we need the receipt parser exactly but okay next what we need to do is register this app so we need to go to appstoreconnect.apple.com and you need a developer account for this to work sign in to your account then you're going to click my apps so these are all of your apps in app store connect we're going to add a new app iOS name Revenue cat demo primary languages English for me and then the bundle ID is not going to appear yet so we need to register this new bundle ID by selecting this link description Revenue cat demo we have in-app purchases already selected I believe yes then all you need to do is go to xcode your project settings and copy your bundle identifier this has to be the exact same or it will not work paste it there under bundle ID explicit and hit continue then we're going to register okay so now we have it back to App Store connect probably have to refresh this page okay so then we are going to add a new app IOS name Revenue cat demo primary language is English Revenue cat demo bundle ID the SKU we can make it if you look at the it's just a unique ID for your app that's not visible on the App Store so we're going to make this 555-321 make it whatever you want for the user access I'm going to hit full access oh looks like our name is already being used Logan's Revenue cat demo that's what I'm going to do okay so now we are in app store connect we're going to come down to subscriptions and this is the bulk of the work the bulk of the work is doing the setup in app store connect believe it or not because once you have this the coding part is pretty straightforward so we are going to go to subscriptions and we're going to create a new subscription but I do want to know if you're doing this tutorial and you're like I don't want subscribers I want to have a model of like a consumable or non-consumable purchase the setup is the same like you would come to in-app purchases hit create and it would say type consumable or non-consumable and consumables are like coins or lives in a game and non-consumables are like a lifetime purchase or lifetime access this tutorial will work if you are doing something like that but for us we're going to do subscriptions create reference Name Pro Plan okay so now we are inside the Pro Plan we're going to hit create for a plan product ID we're going to call this Pro underscore RC for Revenue cap so if your status is ever missing metadata then you still have work to do so we need to fill everything out so that it all makes sense and then we can test it subscription duration we're going to call it one month setup availability we're going to make it available everywhere we're going to add a subscription price I'm just going to do a dollar per month 99 cents it checks the currencies I'm going to hit next firm then you need to add a localization display name Pro Plan access to all features this is what will come up on the App Store when someone is subscribing okay next you need review information so we are going to go back to xcode we are going to run our project that has barely anything in it but it does have the button what we need to do now is take a screenshot of that button so that we can upload it in app store connect here's my simulator okay there we go screenshot stop back to App Store connect then we're going to hit choose file we're going to come to our screenshot that we just took mine was in my desktop and review notes okay so for review notes this is like the person at Apple that is testing this to accept or decline whether it can go in the app store or not we need to describe to them what they're seeing and what to do select the button to subscribe to Pro Plan save okay see how we're looking before you can submit your subscription for review you must add at least one localization to your subscription group so we're going to add localizations which I thought we already did App Store localization okay subscription group display name Pro subscribers create okay now we get prepare for submission ready to submit this is good great yeah we're good we're gonna pop over back to xcode we're going to go to signing and capabilities we're going to select plus capability we're going to go down to in-app purchases and double click that so now we have in-app purchases shown in our xcode project great now the other big chunk of this is setting it up in Revenue cap so we're gonna go to revenue cat we're either going to log in or sign up if you don't have an account yet create an account and then we're going to go to projects create new project project name is going to be called Revenue cat demo create project cool we're going to select the Apple App Store App name Revenue cat demo bundle ID should still be yeah my clipboard so you're going to paste that same bundle ID and now it's asking for a shared secret which we did not get yet head over back to App Store connect and then we're going to go to app information and then toward the bottom you'll see app specific shared secret we're going to hit manage generate we're going to copy this code done back to revenue cap set secret paste set for the p8 key file we do not need that for this demo save changes okay now we're going to go to products add a new product Revenue cap demo identifier this identifier has to match the product ID in the App Store so we're going to go back to App Store connect subscription group reference name product ID is pro underscore RC we're going to copy that back to revenue cat and paste it for our identifier create product then we're going to go to entitlements we're going to select a new entitlement identifier Pro description pro access to all features [Music] and then we need to link our product we're going to hit attach Pro RC all right and then the last part of this we need to go to offerings this describes what is offered to a user on your paywall we need to add a new offering the identifier can be default description is like we'll just we'll just use theirs standard set of packages then you see that there are zero packages here so we're going to select it at new monthly Pro Plan add now we have to attach our product to that package same thing Pro RC attach okay now we should be ready to go now the fun part we're going to code I don't know now we get to set it up for real xcode we're going to add one more file to make this work a little better we're going to call this tab bar and this is just going to be we're going to do command click on the text embed tab View and then this is going to say content view parentheses dot tab item we're going to do image system name star dot slash because it's like hey you don't get a star yet get it we're going to embed this image in a v-stack I'm gonna go text free and we're going to copy all of that from the tab item then we're going to come down and say Pro View and do the same thing except we're going to do star dot fill and call this Pro now we have a tab view when you run the app you can see even in the preview you can see when we click back and forth we're not subscribed yet so we don't get it we need to come up to our app file and we need to import Revenue cap so inside of this struct we are going to add a knit parenthesis for our initializer and then we're going to say purchases dot configure with API key this is a string that we do not have yet we need to go back to revenue cap go to API Keys Revenue cat demo show key we're going to copy this key we're going to paste it here and then we're going to say purchases.log level this basically describes like in our logs how detailed do we want it to be we want it to be very detailed in fact we want it to be dot verbose okay so that is set up now we're going to come over to our content View and we're going to write the function for subscribing okay inside of our content view we need to import Revenue cap then outside of the body we're going to say funk subscribe so we're going to say purchases dot share dot get offerings completion we're going to hit enter it's going to say offerings error in we're going to say if let packages is equal to offerings dot current dot available packages we're going to say purchases dot share dot purchase then we're going to say packages.first and we need to force unwrap this with a completion block we get four variables from this and this will give us back four things we get a transaction we're going to call this purchaser info error and user canceled in then we're going to say if error is not equal to nil comment handle error and then if it is new that's good for us we're going to say if purchaserinfo dot entitlements then here we're going to say Pro dot is active is equal to true then this is a success we're going to comment success and we can do any sort of like user facing Confetti Party Time you subscribed we knew that we want to do we can also say print and then we can do command control space to get our Emoji menu and we can have a big green check mark that says all caps purchase successful now that will handle the purchase but we need some touch-ups here so at the top we're going to say at State private VAR show alert is equal to false at State private VAR alert title is equal to empty string at State private VAR alert description is equal to empty string and then right outside of our v stack we're going to say dot alert is presented is going to be binding dollar sign show alert and then the content is going to be capital A alert title message and dismiss button title is going to be text parentheses alert title message is going to be text parentheses alert description and the dismiss button can just be canceled so this will allow us to control when we show this alert to the user to basically say like Okay purchase failed purchase successful whatever maybe let's start with the error we're going to say alert title is equal to literally whatever you want I'm going to say all caps purchase failed alert description is equal to error colon and then string interpolation backwards slash parentheses error Force unwrap.localized description then we're going to say show alert dot toggle which will change this to true and then the alert pops up with these messages now when it's successful we are already printing it so we're going to say alert title is equal to and I'm just going to copy our print statement purchase successful alert description is equal to you are now subscribed and then show alert dot talk okay so that behavior should be taken care of before we test this I do want to write the logic for the pro view now and hopefully this is like wham bam we're done it works and then I'll sail off into the sunset and then you go make money with your apps this is all you have to do to check the subscription status now Revenue cat has a DOT is subscription active function but we are not going to use that this is the easiest way I've figured out how to do it so outside of the body we're going to say funk check subscription status we're gonna say purchases after we import Revenue cap we're gonna say purchases dot share dot get customer info with a completion customer info and error in if let info is equal to customer info not capitalized has to be the one that we're we're getting through the Callback now we're going to say if info dot entitlements brackets Pro dot is active is equal to true comment we are subscribed okay so then we can't just oh I made that capitalize I shouldn't have done that so we cannot just like return true here for some reason and the easiest way that I could set this up was at State private VAR is subscribed and we will default to false but then we will run this on a pier so we can just plug this in now check subscription status and then when we are subscribed we will say you know a print statement to celebrate of course subscription active then we will do it is subscribe just equal to true so then what we do here in our blur radius we will say is subscribed with a ternary operator question mark If so we're going to make the blur zero and if not we're going to add a colon make it 10. okay so there's a very important part that you need to do before we test this and that is create a sandbox user so when you go to your app store connect go to the top and hit users and access and you need to create a Sandbox tester account now this email has to be a new email that's not being used on your account once you're able to create that you can go to your iPhone settings and hit app store go all the way to the bottom and you'll be able to see sandbox account you could also sign in as you purchase it okay so now we're going to go over to xcode and for our button we need to say subscribe now we should be ready to go sandbox users good app store connect is set up Revenue cat is set up we have our functionality all set up so I'm going to run this on my iPhone because you have to test it on a physical device there is a way to test it on the simulator but I've always just thought it was easier to test on a physical device so I'm recording my iPhone screen all right moment of truth okay subscribe now this takes a second okay look we got our sandbox pop up I'm going to hit subscribe now you should get this or you should get a sign in prompt for your sandbox account but you need a Sandbox account so I'm going to select subscribe I'm going to sign in here done still waiting once again a loading indicator here would be great for the user your purchase was successful now this is an alert that we did not create so when I hit OK we should see our alert after the yeah purchase successful you are now subscribed so it works at least the purchase part of it does so now let's look at checking if it's available go to Pro and look at that we see the text it works so I know this is a very basic implementation of this but this should be enough to at least get you started on the Journey of creating these in-app purchases for your apps like I said if you're doing a consumable or non-consumable purchase like lifetime access or coins or you want to add another subscription this is the route that you should follow you can check for certain entitlement access like is active and then I want to show you one last part if you come to your app file and you need app Delegate for this to work so right above here we're going to say class app delegate type NS object and UI application delegate back in the similar to how UI kit does it and then we're going to say did finish launching with options and then we're just going to return true this is a default function that UI kit projects already have but then here we're gonna come down into the struct of Revenue cat demo app and we're going to say at UI application delegate adapter parentheses appdelegate dot self we're going to say VAR app delegate then you can come down and write an extension for app delegate and we're gonna use purchases delegate and there's a function called purchases received updated so I'm just going to add this as a comment for now but this is where you would handle changes to customer info so maybe someone unsubscribed this is where you would get that update and maybe if you do check for the pro view like every time on a peer you know that'll still be fine and I mean you could still do this check on a pier where you check for a subscription status but this app delegate function will allow you to receive these updates right to here and then from here you can say like you know user profile dot is subscribed is equal to false and then you could like update the user's experience based off them not being a subscriber anymore so yeah there you have it I know this isn't like the most detailed thing but like I said this should be enough for you to at least get started with Revenue cat from here you would be able to see you know how many users are subscribing and how much money you're making all that inside of the revenue cap dashboard so thank you for watching subscribe for more I got some really cool videos on the way thanks
Info
Channel: Logan Koshenka
Views: 5,486
Rating: undefined out of 5
Keywords: iOS revenuecat tutorial, iOS subscriptions, iap, in app purchases swift, in app purchases swiftui, revenue cat, revenuecat, revenuecat benefits, revenuecat ios, revenuecat swift, revenuecat swiftui, revenuecat tutorial, revenuecat tutorial iOS, revenuecat tutorial swift, revenuecat tutorial swiftui, swift revenue cat, swift revenuecat, swift revenuecat tutorial, swift ui tutorial, swiftui, swiftui revenue cat, swiftui revenuecat, swiftui revenuecat tutorial, swiftui tutorial
Id: dBX2nyTcmjA
Channel Id: undefined
Length: 20min 9sec (1209 seconds)
Published: Mon Apr 10 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.