Skip to content

Releases: rechsteiner/Parchment

v1.0.0

29 Jan 19:02
8266c2b
Compare
Choose a tag to compare

This release introduces a lot of breaking changes, a bunch of new features and a couple of bug fixes. Here are the most notable changes, with a full list of changes below:

Removed PagingOptions initializer #98

All configuration is now moved into properties on the PagingViewController class. You no longer have to initialize a PagingViewController with 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. All the properties on the PagingTheme protocol has also moved into separate properties on PagingViewController.

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

Renamed data source #99

The current data source protocol has been renamed to PagingViewControllerInfiniteDataSource and moved into the property called infiniteDataSource.

Added new data source #99

A new PagingViewControllerDataSource protocol has been added that makes it easier to set up a custom data source if you have a fixed number of view controllers. To use the new data source, you only need to return the total number of
view controllers as well as the view controller and PagingItem for a given index. The new data source replaces the existing dataSource property.

Example:

extension ViewController: PagingViewControllerDataSource {

  func numberOfViewControllers<T>(in: PagingViewController<T>) -> Int {
    return items.count
  }  

  func pagingViewController<T>(_ pagingViewController: PagingViewController<T>, viewControllerForIndex index: Int) -> UIViewController {
    return ItemViewController(item: items[index])
  }

  func pagingViewController<T>(_ pagingViewController: PagingViewController<T>, pagingItemForIndex index: Int) -> T {
    return items[index] as! T
  }
}

...

pagingViewController.dataSource = self

Updated delegate protocol #100

Three new delegate methods have been added to the PagingViewControllerDelegate protocol. You can now be notified before, during and after the user navigates to another view controller:

protocol PagingViewControllerDelegate: class {

  func pagingViewController<T>(
    _ pagingViewController: PagingViewController<T>,
    isScrollingFromItem currentPagingItem: T,
    toItem upcomingPagingItem: T?,
    startingViewController: UIViewController,
    destinationViewController: UIViewController?,
    progress: CGFloat)

  func pagingViewController<T>(
    _ pagingViewController: PagingViewController<T>,
    willScrollToItem pagingItem: T,
    startingViewController: UIViewController,
    destinationViewController: UIViewController)

  func pagingViewController<T>(
    _ pagingViewController: PagingViewController<T>,
    didScrollToItem pagingItem: T,
    startingViewController: UIViewController?,
    destinationViewController: UIViewController,
    transitionSuccessful: Bool)

  func pagingViewController<T>(
    _ pagingViewController: PagingViewController<T>,
    widthForPagingItem pagingItem: T,
    isSelected: Bool) -> CGFloat?
}

The widthForPagingItem: delegate has been changed to return CGFloat? instead of CGFloat (See: #100). The default implementation will return nil.

Removed FixedPagingViewControllerDelegate protocol #100

The FixedPagingViewControllerDelegate protocol is replaced by the PagingViewControllerDelegate protocol. The new delegate does not include the index for the paging items, but you can get the current index from the PagingIndexItem like this:

extension ViewController: PagingViewControllerDelegate {
  func pagingViewController<T>(_ pagingViewController: PagingViewController<T>, didScrollToItem pagingItem: T, startingViewController: UIViewController?, destinationViewController: UIViewController, transitionSuccessful: Bool) {
    if let indexItem = pagingItem as? PagingIndexItem {
      print("index: ", indexItem.index)
    }
  }
}

Added

  • Add option to always center selected menu item #101
  • Allow subclassing the collection view layout #104
  • Add empty implementations of collection view delegate methods (4840483)
  • Add option to disable content interaction #113
  • Add option for selected background color #114
  • Add method for selecting paging items based on index #117

Changed

  • Rename selectPagingItem to select(pagingItem:) #105
  • Make PagingState property public #107
  • Make PagingItems struct public #108
  • Make PagingState extension properties public (f842a7b)
  • Make indicator layout attributes open to allow subclassing (7c35acc)
  • Change collection view delegate methods to open (68b125b)
  • Replace PagingTheme with PagingOptions #111
  • Rename headerBackgroundColor to menuBackgroundColor #116

Fixes

  • Fix performance issue with updating content offset #106
  • Set background color for paging cell based on options (1a70bd6)
  • Fix layout calculation when using transforms #102
  • Account for menu spacing when generating items #103
  • Fix bug with animation when selecting items (73913f)

v0.9.0

25 Dec 15:01
2cbd9a1
Compare
Choose a tag to compare
  • Add method for reloading data #94
  • Allow setting different width for selected cell #85

v0.8.0

19 Nov 16:01
a8eac64
Compare
Choose a tag to compare
  • Fix selecting paging items before view appears #79
  • Fix issues with safe area insets #81

v0.7.0

07 Nov 21:01
fbc2e57
Compare
Choose a tag to compare
  • Change access for EMPageViewController delegate method #72
  • Improve performance by using manual frames for menu cells #68
  • Add option to customize indicator and border view #67
  • Update documentation #60

v0.6.0

25 Sep 21:54
Compare
Choose a tag to compare
  • Upgrade to Swift 4.0 #54
  • Fix bug where selecting items was not working #55

v0.5.0

22 Aug 18:10
Compare
Choose a tag to compare

Add support for scrolling in header #48

  • Require PagingItem to conform to Hashable and Comparable: fbd7aff
  • Write custom collection view layout instead of using UICollectionViewFlowLayout c6f78b4

Note: With this change, Parchment requires PagingItem to
conform to both Hashable and Comparable. This means any
existing PagingItem implementation have to be updated.

v0.4.0

04 May 21:07
Compare
Choose a tag to compare
  • Add delegate for selected items in FixedPagingViewController #46
  • Fix issue with delayed rendering #45

v0.3.0

12 Mar 13:56
Compare
Choose a tag to compare
  • Allow selectPagingItem to be called before viewDidAppear #32
  • Update EMPageViewController #36 Thanks @AYastrebov!
  • Fix calculation for transition distance #33
  • Fix background color on header view #41
  • Move collection view above paging view #31

v0.2.0

19 Feb 15:23
Compare
Choose a tag to compare
  • Add progress value to menu items: #20
  • Scroll menu items alongside content: #22
  • Option to add spacing to indicator: #27 Thanks @AYastrebov 🙌

Swift 3.0

08 Dec 16:04
Compare
Choose a tag to compare
  • Update to Swift 3.0 #11
  • Add support for centering fixed width menu items #10

Big thanks to @IanHoar for these updates 🙌