Releases: danielsaidi/Sheeeeeeeeet
1.2.2
This hotfix adds two new properties to ActionSheetSelectItem
, that can be used to style the selected fonts: selectedTitleFont
and selectedSubtitleFont
.
1.2.1
This hotfix fixes a font bug in the title item and color bugs in the select item.
1.2.0
This is a huge update, that completely rewrites how action sheet appearances are handled. Instead of the old appearance model, Sheeeeeeeeet now relies on the iOS appearance proxy model as much as possible.
The old appearance model is still around, but has been marked as deprecated, and will be removed in 1.4.0
. Make sure that you switch over to the new appearance model as soon as possible. Have a look at the example app and [here][Appearance] to see how you should customize the action sheet appearance from now on.
In short, item appearance customizations are handled in three different ways now:
- Item appearances such as colors and fonts, are customized with cell properties, for instance:
ActionSheetSelectItemCell.appearance().titleColor = .green
. - Item heights are now customized by setting the
height
property of every item type you want to customize, for instance:ActionSheetTitle.height = 22
. - Action sheet margins, insets etc. are now customized by setting the properties of each
ActionSheet
instance. If you want to change the default values for all action sheets in your app, you have to subclassActionSheet
.
All built-in action sheet items now have their own cells. Your custom items only have to use custom cells if you want to apply custom item appearances to them.
Sheeeeeeeeet now contains several new views, which are used by the action sheets:
ActionSheetTableView
ActionSheetItemTableView
ActionSheetButtonTableView
ActionSheetBackgroundView
ActionSheetStackView
The new classes make it easy to modify the appearance of these views, since they have appearance properties as well. For instance, to change the corner radius of the table views, just type: ActionSheetTableView.appearance().cornerRadius = 8
.
ActionSheet
has two new extensions:
items<T>(ofType:)
scrollToFirstSelectedItem(at:)
This new version has also rebuilt all unit tests from scratch. They are now more robust and easier to maintain.
1.1.0
This version increases the action sheet integrity by restricting what you can do with it. This involves some breaking changes, but they should not affect you. If you think any new rule is bad or affect you, please let me know.
New Features
@sebbo176 has added support for subtitles in the various select items, which now also changes the cell style of an item if the subtitle is set. He has also added an unselected icon to the select items, which means that you can now have images for unselected items as well (e.g. an unchecked checkbox).
Breaking Changes - ActionSheet:
-
The
items
andbuttons
properties are nowinternal(set)
, which means that they can only be set withinit(...)
or withsetup(items:)
. This protects the integrity of the item and button separation logic. -
The code no longer contains any
didSet
events, since these events called the same functionality many times. Callrefresh
if you change any outlets manually from now on. -
Since the
didSet
events have been removed,refreshHeaderVisibility
is only called once and has therefore been moved intorefreshHeader
. -
Since the
didSet
events have been removed,refreshButtonsVisibility
is now only called once and has therefore been moved intorefreshButtons
. -
A small delay in
handleTap(on:)
, that should not be needed, has been removed. Let me know if it causes any side-effects.
1.0.2
This version adds new background color properties to the action sheet appearance, to make it possible to set the background color of the table views. The properties are called backgroundColor
, itemsBackgroundColor
and buttonsBackgroundColor
. Note that the items still have their own background colors, which will overlap the table view background color.
This version also fixes a bug, where the background color behind an action sheet went black when the action sheet was presented in a split view.
1.0.1
This version fixes a bug, where the presenters incorrectly updated the scrolling behavior of the action sheet when rotating the device.
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.
0.11.0
This version adds a customAppearance
property to ActionSheetItem
and fixes a few appearance glitches. Overall, it makes the appearance setup more consistent.
-
I use early returns in every appearance class and have optimized imports. Many appearance classes have also been made
open
instead ofpublic
. -
The
ActionSheetItemAppearance
now has extensions fornoSeparator
, that can be used to hide the separator for certain item types. -
The
ActionSheetCollectionItemAppearance
andActionSheetCustomItemAppearance
andActionSheetSectionMarginAppearance
classes have no overridden initializers anymore. This makes the work as expected when you use the same appearance tweaks as everywhere else. -
The
ActionSheetPopoverApperance
class doesn't inherit any appearance classes and has thus been moved out to the appearance root.
0.10.0
Sheeeeeeeeet
has a new item type: ActionSheetCustomItem
. You can use it when you want to use a completely custom view in your action sheet. Just tell it what view you want to use and make sure that the view class inherits ActionSheetItem
and implements ActionSheetCustomItemCell
. Have a look at the example app for a simple example.
ActionSheetCollectionItem
cellType
has been renamed to itemCellType
, which makes it clearer that the type regards the collection view items.
ActionSheetItem
now has a cellReuseIdentifier
and className
property, that can be useful when sublassing various item classes. It also makes it much easier to register custom cell types. See ActionSheetCollectionItem
cell(for: ...)
.
The collection item CollectionItemCellAction
has been renamed to CellAction
.
0.9.9
Let's all party like it's 0.9.9!
I've done some refactoring and will introduce a few breaking changes that can be easily fixed. They will hopefully not affect you at all.
ActionSheetItem
has an itemType
property, that can be used to e.g. check the type of item that is tapped. For now, the enum has item
, button
and title
.
The ActionSheetMargin
fallback
function param has been renamed to minimum
.
ActionSheetItemSelectAction
has been renamed to ActionSheetItem.SelectAction
and ActionSheetItemTapAction
has been renamed to ActionSheetItemTapAction
.
ActionSheetItemHandler.CollectionType
has been renamed to ItemType
.
The two ActionSheetItem
handleTap
functions have been combined to one single function.