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

Allow user to set the paywall content max width #4116

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

MojtabaHs
Copy link

@MojtabaHs MojtabaHs commented Jul 26, 2024

Motivation

Sometimes, it's not ideal to use the entire width of the screen for the paywall.

↔️ Default Look

For example, a fullscreen paywall on an iPad looks like this by default:
old
👆This is a 10-inch iPad, but imagine a 13-inch!

This extremely wide content looks off, doesn't it? Who needs a button that's 2752 px (or 1376 pt) wide?! 😱 (Specially with these short texts!)


✅ Customized with the New API

By limiting it to a more readable size, it looks like this:
new
👆The width of this paywall is limited to the native Readable Content Guide.

Much better, right?

💡 Usage

PaywallView()
    .environment(\.paywallContentMaxWidth, UIViewController().view.readableContentGuide.layoutFrame.size.width)

👆I used the native readableContentGuide as Apple suggested for the device here, but the user can pass any value that suits them.


More about this contribution
  • Fully backward-compatible
  • Works on all supported devices
  • No breaking changes
  • Tested on a real device (you can see the result in the provided gif images above)
  • Works on both v4 and the new v5

@MojtabaHs
Copy link
Author

Rebased on the main branch.

@MojtabaHs
Copy link
Author

Any Updates here?

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

Successfully merging this pull request may close these issues.

1 participant