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
Unable to set the desired page dimensions #45
Comments
@teameh , this isn't how
That's physically not possible. What you're trying to do can be achieved like this:
Notice |
Thanks for helping me understand how it should work 😊! But that would only work if you have space for a GeometryReader to size up the whole screen right? That won't work If I put the
Will (logically) result in: I'm just trying to embed the pager in between other components without a lot of padding on the top and bottom. I could leave the GeometryReader out and use use:
But now I don't see enough of the next page: I understand that this is not how you foresaw the Pager being used but allowing these kind of results would open the component up for a lot more use cases right? |
I get that it's not how it's meant to work, but maybe something like would work? teameh@3c22c82#commitcomment-39527479 (would need a lot more work of course, but it's just an idea) |
You'll have to find the appropriate combination of these elements to satisfy your needs. You use |
@teameh , I appreciate your enthusiasm, but have in mind this library is not meant for a specific case. You can't specify a page size because it depends on the size of the container. You can see how the page size is defined here, and figure out what changes you need to get that size:
Plus, the scroll offset depends on the container size. It will simply not work |
I'm noticing now that the problem in your example is that you're giving the
|
@teameh I've published a 1.6.0-beta.1 adding Hope that helps you. Technically you can achieve the same by using those two modifiers but I'll give you that this could be convenient in some cases. |
Yeah, sorry that your project had to be the first SwiftUI Component I’m trying to integrate. There’s clearly some knowledge missing on my part here. Thanks for the info, I just logged off and I’m away this weekend but will get to this asap on Wednesday! Really awesome you pushed a beta release containing that option, looking forward to trying it out! Cheers! |
Sure no worries, there's always a first time. I'm trying to please everybody here, to me anyone that is interested in this library deserves my attention. But there's a compromise in the number of modifiers I can add. Every new modifier I add makes the code more difficult to maintain as there are more conditions. Anyway, I saw your point and agree it can be a bit confusing if you need to set a constant pageSize. I'll leave the issue open till I hear from you. |
🙏 🙌 Cheers, that's really nice! Yeah I understand you don't just want to keep adding a bunch of modifiers. From what I can tell from playing with it a little bit this works great. I'll continue working on this tomorrow and will let you know if I run into any issues. Again thanks for the modifier, it helps a lot! |
I’m glad it helped |
I'm closing this as it's Production ready. Feel free to open a new issue if you find bug, that way we create a new thread |
Hey @fermoya, another issue from me.
I'm just playing with the component a bit to see if it fits my needs. Feel free to close these issues if these uses cases are not something you would like to support.
I'm trying to create a pager that looks something like this:
A pager with pages with an itemAspectRatio greater than 1 so they're wider than they're tall with only a little bit of padding on the top and bottom. Also, I would like to see quite a bit of the next page.
If I try to create this by using
itemAspectRatio
my pager always has a lot of padding on the top or bottom. There seems to be no way to fix this with the current attributes. I'm fairly new to SwiftUI so please correct me if there is a way to accomplish this.I've taken your sample and added 2 sliders for the
itemAspectRatio
andframe.height
to play with but I can't make it work.The closest I get is by setting the
itemAspectRatio
to 0 but that gives me a pager where I can barely see the next card.Wouldn't it be an option to make the
pageSize
an attribute the user can set directly?That would give a lot of freedom and open the component up to a lot more use cases!
Or even on a per page basis, that would make the component even more flexible:
Looking forward to hearing your thoughts!
The text was updated successfully, but these errors were encountered: