How I Added In-App Purchases & GameCenter to My SpriteKit Game
JohnDav JohnDav
1.65K subscribers
1,498 views
0

 Published On Jan 6, 2023

I made this game, Shapes & Numbers, a few months ago using Swift Playgrounds. During this process, one of the things I found out was that there are some important missing capabilities when using Swift Playgrounds. Namely - you can't add game center OR in-app purchases to your app.

So... I converted the Swift Playgrounds project over to an Xcode project and got to work integrating these two capabilities into my game.

0:00 - Intro and Setup
0:24 - Adding GameCenter to SpriteKit Game
5:37 - Adding In-App Purchases to SpriteKit Game

It was slow going since Apple doesn't make it easy to convert a Swift Playgrounds project into a full Xcode project. But once I figured that out, I was able to add some boilerplate code I found on Apple's Developer documentation. Adjust it using the information I found on Stack Overflow and I was off to the races.

I now have a working sandbox of my first in-app purchase and two leaderboards in a game that I started making using Swift Playgrounds with SwiftUI.

Are there better ways to do this? Absolutely - but this way seems to be working so far and I've learned a lot about adding Game Center and adding in-app purchases to my iOS projects that I'll be able to take with me to future builds.

I hope you enjoyed this video!

Converting Swift Playgrounds to XCODE:    • Apple This Needs To Be Easier: Conver...  

//Things I've Made
ZER0ED: https://apps.apple.com/us/app/zer0ed/...
Shapes&Numbers: https://apps.apple.com/us/app/shapes-...
My Website: https://www.johndav.com

//Affiliate Links To Gear I Use
MacBook: https://amzn.to/3q6y8wT
iPad Pro: https://amzn.to/37EZmol
Apple Pencil: https://amzn.to/3iba2gb
Camera: https://amzn.to/363IpDp
Lens: https://amzn.to/3iiLSAl
SM7B: https://amzn.to/3IjSclM

show more

Share/Embed