purchases-ios
purchases-ios copied to clipboard
`showManageSubscriptions` and `beginRefundRequest`: swiftUI view modifiers
For SwiftUI apps, we should provide view modifiers to make it easy to use showManageSubscriptions
and beginRefundRequest
.
We can use #if canImport(SwiftUI)
to only declare these when SwiftUI types are available.
For reference, here are the view modifiers declared by StoreKit.
// Available when SwiftUI is imported with StoreKit
@available(iOS 15.0, *)
@available(macOS, unavailable)
@available(tvOS, unavailable)
@available(watchOS, unavailable)
extension View {
public func manageSubscriptionsSheet(isPresented: Binding<Bool>) -> some View
}
// Available when SwiftUI is imported with StoreKit
@available(iOS 15.0, *)
@available(macOS, unavailable)
@available(tvOS, unavailable)
@available(watchOS, unavailable)
extension View {
public func refundRequestSheet(for transactionID: UInt64, isPresented: Binding<Bool>, onDismiss: ((Result<Transaction.RefundRequestStatus, Transaction.RefundRequestError>) -> ())? = nil) -> some View
}
https://app.shortcut.com/revenuecat/story/11882/showmanagesubscriptions-and-beginrefundrequest-swiftui-view-modifiers
Love it! I'd like to do it if it's still available :)
I imagine we will grow SwiftUI extensions a lot over time. We might want to offer them separately eventually, or maybe now? There's something to be said about thin frameworks, and if a user doesn't need SwiftUI it doesn't make sense to include it for everyone IMO.
🤔 Good point.
My two cents. Maybe not now, but as you said, there could be another UI related framework to isolate the Core layer from the UI.
Yeah, I think it'd be nice and easy to set up as a separate pod and swift package. It'd also allow us to provide other extensions for SwiftUI to make life a lot easier for devs
Hey 👋
I spotted the thread when I was looking here and there. It has the you can do this
tag, so is it something that I can contribute to or the topic is on hold?
Hey @Zaprogramiacz! 👋
You are absolutely welcome to contribute to this! We're more than happy to review and to assist with any questions you have along the way 💪
Oh great 💪🏻
Do you have any documentation, task with AC or desired dreamed solution? I don't have an access to the link from the first post and I bet that I might find there useful info.
In the thread I saw that last idea was to setup a separate pod and swift package with SwiftUI extensions. Is it still the main idea that should be followed?
Hey, sorry for the late reply. Yeah, that's still the main idea, to have a separate SPM package and maybe also a pod, with just the SwiftUI extensions