Skip to main content
InterviewHubPRO
Section Overview
Q45

Question 45 of 50

Part 3: Instruments Profiling, App Architecture & Production Hardening (25 - 35)

90%
iOS Platform & SwiftUI (50 Qs)•Part 3: Instruments Profiling, App Architecture & Production Hardening (25 - 35)

In-App Purchases (IAP) & StoreKit 2: `Product.purchase()` and cryptographic JWS verification.

senior LevelCode ExamplePerformanceSystem DesignData Structures

In Simple Words: Apple's modern StoreKit 2 API simplifies purchases using native async/await:

swift
let products = try await Product.products(for: ["monthly_sub_10"])
let result = try await product.purchase()

switch result {
case .success(let verification):
  let transaction = try checkVerified(verification)
  await transaction.finish() // Must finish transaction to complete Apple ledger
case .userCancelled, .pending:
  break
}
  • Every transaction is cryptographically signed using JSON Web Signature (JWS), allowing on-device verification without a backend receipt validation server.