Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

showManageSubscriptions and beginRefundRequest: swiftUI view modifiers #1073

Open
aboedo opened this issue Dec 13, 2021 · 8 comments
Open

showManageSubscriptions and beginRefundRequest: swiftUI view modifiers #1073

aboedo opened this issue Dec 13, 2021 · 8 comments

Comments

@aboedo
Copy link
Member

aboedo commented Dec 13, 2021

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

@Juanpe
Copy link
Contributor

Juanpe commented Dec 14, 2021

Love it! I'd like to do it if it's still available :)

@NachoSoto
Copy link
Contributor

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.

@Juanpe
Copy link
Contributor

Juanpe commented Dec 14, 2021

🤔 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.

@aboedo
Copy link
Member Author

aboedo commented Jan 4, 2022

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

@Zaprogramiacz
Copy link

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?

@aboedo
Copy link
Member Author

aboedo commented Nov 7, 2022

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 💪

@Zaprogramiacz
Copy link

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?

@aboedo
Copy link
Member Author

aboedo commented Nov 23, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants