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

Replace PagingOptions with property assignments #98

Merged
merged 9 commits into from
Dec 27, 2017
Merged

Conversation

rechsteiner
Copy link
Owner

@rechsteiner rechsteiner commented Dec 25, 2017

This introduces a breaking change: All configuration is now moved
to properties on the PagingViewController class instead of having to
pass in an instance conforming to the PagingOptions protocol.

This reduces the boilerplate of having to create a separate options
struct when you just need to override a single value. It also means
you can change the options after the PagingViewController has been
initialized. Lastly, this change also means we can introduce better
support for customizations through Storyboard in the future.

Before:

struct Theme: PagingTheme {
  let textColor: UIColor = .red
}

struct Options: PagingOptions {
  let theme: PagingTheme = Theme()
  let menuItemSize: PagingMenuItemSize = .fixed(width: 100, height: 40)
}

let pagingViewController = PagingViewController(options: Options())

After:

let pagingViewController = PagingViewController()
pagingViewController.menuItemSize = .fixed(width: 100, height: 40)
pagingViewController.textColor = .red

This change introduces a breaking change. All configuration is now
moved to properties on the PagingViewController class instead of having
to pass in an instance conforming to the PagingOptions protocol.

This reduces the boilerplate of having to create a separate options
struct when you just need to override a single value. It also means
you can change the options after the PagingViewController has been
initialized. Lastly, this change also means we can introduce better
support for customizations through Storyboard in the future.
Whenever the layout invalidates everything we generate the layout
attributes for the decoration views. This ensures that the decoration
views looks correct any of the options changes after the initial render.
Removes/adds any swipe gesture recognizers and updates the scroll
interaction on the collection view whenever the .menuInteraction
property changes.
@rechsteiner rechsteiner merged commit b329921 into 1.0 Dec 27, 2017
@rechsteiner rechsteiner deleted the properties branch December 27, 2017 12:05
@rechsteiner rechsteiner mentioned this pull request Jan 23, 2018
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