Avatar ·

How to add In-App Purchase in iOS using Swift?

Hi everyone! I'm a beginner iOS developer, writing my first app in Swift. I want to add the ability to purchase premium features via In-App Purchase. I read Apple's documentation, but I'm still confused. I have a simple screen with a "Buy Premium" button. I created a product in App Store Connect, but I don't understand how to properly request products from StoreKit and handle the purchase. Here's my current code (draft): ```swift import StoreKit class PurchaseManager { func buyPremium() { // How do I request the product here? // I tried SKProductsRequest, but I don't know where to put the product identifier } func handlePurchase() { // What should I do after the user taps "Buy"? } } ``` Main questions: 1. How to properly