Post

Replies

Boosts

Views

Activity

Reply to iOS 17 Toolbar Bugs
It works for me only in sheet presentation, and only first time (when I only open this screen, not another one before!). And if I hide my screen with toolbar in my app by menu presentation and open it again (here the screen is not hidden or closed). I think, view rebuilds itself again and all custom buttons in toolbar are visible. WTF with Apple Dev??
Mar ’24
Reply to StoreKit 2 isEligibleForIntroOffer
Better use it: ///Check the subscription to determine whether the user is eligible for an introductory offer. public func isEligibleForIntro() -> Bool { let selectedProduct = subscriptions.first(where: { $0.id == selectedProductID }) return selectedProduct?.subscription?.introductoryOffer?.type == .introductory } Because with https://developer.apple.com/documentation/storekit/product/subscriptioninfo/3803203-iseligibleforintrooffer/ func eligibleForIntro(product: Product) async throws -> Bool { guard let renewableSubscription = product.subscription else { // No renewable subscription is available for this product. return false } if await renewableSubscription.isEligibleForIntroOffer { // The product is eligible for an introductory offer. return true } return false } I have a problem with the implementation in View... Thanx @AaronIntohand
Nov ’23
Reply to Transaction.currentEntitlements is not consistent
/// Sorry, it's not answer for your issue... /// What I've not seen in your transaction: ///Always finish a transaction. await transaction.finish() Next code looks like extra: if purchasedProductIDs != self.purchasedProductIDs { self.purchasedProductIDs = purchasedProductIDs } I use this, Set uses only unique values: if transaction.revocationDate == nil { self.purchasedSubscriptions.insert(subscription) } else { self.purchasedSubscriptions.remove(subscription) } Typically, Task is used as follows: Task(priority: .background) {} The value var hasUnlockedPro: Bool is better stored in @AppStorage.
Nov ’23
Reply to SwiftUI: @StateObject never deinitialized
⚠️ do not forget to add .navigationViewStyle(.stack) to Navigation View. It will deinit() the view model ⚠️ But it's also important to kill all objects in the ViewModel to clear the memory graph. When you use Combine for example)) Without it, the Debug Navigator will tell you about warnings. Add to ViewModel: `public func invalidate() {     cancellable?.cancel()     cancellable = nil     print("[<<] invalidated")   } And call in MySwiftUIView(): ` .onDisappear {       vm.invalidate()     }
Mar ’23
Reply to How can I get ID Token again?
in AppDelegate() //Get ID Token on Debug Console for A/B Testing (hide when unused!)     //////////////////////////////////////////////////////////////// Installations.installations().authToken { result, _ in      print("\nYour instance ID token is -> (result?.authToken ?? "n/a") <-\n")     }
Nov ’21