Skip to content

1.0.0

Compare
Choose a tag to compare
@danielsaidi danielsaidi released this 19 Oct 07:53
· 432 commits to master since this release

Sheeeeeeeeet 1.0.0 is finally here, with many internal changes and some external ones.

This version decouples action sheets from their presentation to great extent. An action sheet still styles its items and components, but the presenters now takes care of a lot more than before. The sheet setup is now also based on constraints instead of manual calculations, which means that popover scrolling etc. works by how the constraints are setup, instead of relying on manual calculations.

This should result in much more robust action sheets, but it requires testing on a wide range of devices and orientations before it can be released as a 1.0.

IMPORTANT The button item values have changed. Insted of true and nil they now have a strong ButtonType value. You can still create custom buttons with a custom value, though. You can also use the new isOkButton and isCancelButton extensions to quickly see if a user tapped "OK" or "Cancel".

Breaking changes

Since the presentation logic has been rewritten from scratch, you have to adjust your code to fit the new structure, if you have subclassed any presenter or made presentation tweaks in your sheets. The changes are too many and extensive to be listed here, so please have a look at the new structure. There is much less code, so changing your code to the new standard should be easy.

  • ActionSheetButton and its sublasses has new values.
  • ActionSheet.itemTapAction has been removed
  • ActionSheet.handleTap(on:) is now called when an item is tapped
  • ActionSheetAppearance.viewMargins is renamed to groupMargins
  • ActionSheetItem.itemType has been removed; just check the raw type
  • ActionSheetItem.handleTap(in:) no longer has a cell parameter
  • ActionSheetStandardPresenter is renamed to ActionSheetStandardPresenter

New features

  • ActionSheetAppearance has new properties, which adds new way to style sheets.
  • ActionSheetButton adds isOkButton and isCancelButton extension functions to ActionSheetItem. They can be used to quickly check if a cancel or ok button was tapped, instead of having to check if the item can be cast to a button type.

Bug fixes

  • The big presentation adjustments solves the scrolling issues that occured with popovers and many items.
  • The hideSeparator() function is adjusted to behave correctly when the device is rotated.

Deprecated logic

Instead of deprecating presentation-related properties and functions that are no longer used or available, I removed them completely. Let me know if you used any properties that are no longer available.

  • ActionSheetItem.setupItemsAndButtons(with:) is renamed to setup(items:)
  • ActionSheetItem.itemSelectAction is renamed to selectAction

Perform the deprecation warnings, and you should be all good. Deprecated members will be removed in the next minor version.