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

Merge 4.0 into main #713

Merged
merged 48 commits into from
May 25, 2024
Merged

Merge 4.0 into main #713

merged 48 commits into from
May 25, 2024

Conversation

rechsteiner
Copy link
Owner

No description provided.

The new API replaces the PagingItem initializer with a new Page struct
that let's you define custom header items per page. Each page can
define their own custom SwiftUI view as the menu item, and it can be
customized based on the selection and progress. The new API also
supports result builders, which makes it easier to create PageViews
with a fixed number of pages.
Add new API for PageView implementation in SwiftUI
This ensures that the menu is shown below the navigation bar by
default. This could potentially break apps that expect this to be
constrained to the top of the view, and they would need to provide
their own PagingView subclass that overrides the constraints.
When swiping fast to the next view controller, the scroll view will
overshoot and trigger additional isScrollingFrom methods after
didFinishScrollingFrom is called. This is expected, but the view
controllers that are returned are the previously selected view
controller and not the upcoming view controller. This was done to
avoid triggered view controller appearance method (like
viewWillAppear) for the upcoming view controllers when overshooting,
but it seems like this is not happening anymore, so we can just remove
this workaround.
Constrain menu to safe area insets by default
Fix PageViewController isScrollingFrom delegate when overshooting
By increasing the minimum target for the SwiftUI views to iOS 14, we
can use UIContentConfiguration to simplify the integration between
UIKit and SwiftUI. We can now use the new UIHostingConfiguration on
iOS 16 and fall back to UIHostingController using a custom
UIContentConfiguration on older versions.
In #668, the logic for menuPosition was removed by accident. This
brings it back and fixes some auto layout warnings.
In #668, the logic for menuPosition was removed by accident. This
brings it back and fixes some auto layout warnings.
Fix PagingView layout constraints
Drop iOS 13 for SwiftUI views and use UIContentConfiguration
Update to recommended Xcode project settings
Add missing color modifiers to PageView
Fix didSelectItem delegate being called before actual selection
Allow setting PageView closures multiple times
When Parchment selects items outside of the visibleItems range, it
needs to know whether that it is before or after the selected item so
it can animate in the correct direction.

This worked fine when all items where of the same type, but if you
mixed multiple types they needed to know about each other. If you used
the build-in PagingIndexItem, it would not know about your custom
items and the animation would be wrong. This is now fixed by
introducing a new PagingIndexable protocol that PagingIndexItem used
to compare itself against. This can then be used by custom items, like
in the IconItem example.
Add new PagingIndexable protocol to allow comparison between items
Calling layoutIfNeeded when laying out the page view sometimes caused
apps to crash when this was done while hidden. It also does not work
when rotating the device while another view is pushing.
When rotating the device while pushing another view, the menu would be
messed up when navigating back to this view.
rechsteiner and others added 16 commits April 7, 2023 17:03
When enabled, the items in the menu will be selected while scrolling.
Fix rotation and crash issues with calling layoutIfNeeded
Add support for new wheel menu interaction
This allows you to define a custom PagingIndicatorStyle which can
contains any type of SwiftUI view that you prefer.
Add custom style for indicator view when using SwiftUI
Add Example target as shared scheme
Conflicts:
	Parchment.xcodeproj/project.pbxproj
	Parchment.xcodeproj/xcshareddata/xcschemes/Example.xcscheme
	Parchment.xcodeproj/xcshareddata/xcschemes/ExampleSwiftUI.xcscheme
	Parchment.xcodeproj/xcshareddata/xcschemes/Parchment.xcscheme
	README.md
The current implementation calls reloadData on each update, which
re-creates the entire content view and resets any state (like
scrolling). To prevent this, we update the existing
UIHostingController if the current page is the same.

This requires us to have stable identifiers, to know if the current
page is the same as before or a new one. For title-based pages, we
just use the title as the identifier. For pages with custom SwiftUI
headers, we default to using the index of the view as the
identifier. This is the same behaviour that we have today, although it
will only work when having static pages. In order to support dynamic
pages with custom SwiftUI headers, we introduce a new initializer that
allows specifying the identifier.
@rechsteiner rechsteiner reopened this May 24, 2024
@rechsteiner rechsteiner merged commit 38dbade into main May 25, 2024
1 check passed
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.

3 participants