1.0.0
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 removedActionSheet.handleTap(on:)
is now called when an item is tappedActionSheetAppearance.viewMargins
is renamed togroupMargins
ActionSheetItem.itemType
has been removed; just check the raw typeActionSheetItem.handleTap(in:)
no longer has acell
parameterActionSheetStandardPresenter
is renamed toActionSheetStandardPresenter
New features
ActionSheetAppearance
has new properties, which adds new way to style sheets.ActionSheetButton
addsisOkButton
andisCancelButton
extension functions toActionSheetItem
. 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 tosetup(items:)
ActionSheetItem.itemSelectAction
is renamed toselectAction
Perform the deprecation warnings, and you should be all good. Deprecated members will be removed in the next minor version.