Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added
left/right/above/below
directions toDepthPreset
.We can now use,
depthPreset = .below(.right(.depth5)))
and get shadow cast below and right of the view.Using the same modifier twice just increases the offset:
Default is direction is
below
.Note: Had to remove
@objc
to add this feature.Added
.custom(x)
case forHeightPreset
.Note: Had to remove
@objc
to add this feature.Added support for
heightPreset
inBottomNavigationController
.Manipulating
tabBar.frame
was only working inlayoutSubviews()
. Using this way had drawbacks:tabBar
height was returned back to default on rotation.selectedViewController?.view.frame
was not changing even though it was calculated and set. (It should shrink as the tabBar grows occupying the space)Fortunately, tabBar height is taken via
sizeThatFits
method, so I useUITabBar
subclass returning custom height based onheightPreset
value.v.height - HeightPreset.normal.rawValue
calculates the offset of the system from our reference. It allows us to match system's behavior.Suppose
tabBar.heightPreset = .normal //rawValue is 49
andsuper.sizeThatFits(size).height
returns49
. In this case resulting height becomes49
, if the system would return83
or58
(values are for iPhoneX's portrait and landscape orientation respectively), the resulting height would be the same. If we settabBar.heightPreset = .xxlarge
then for iPhoneX's portrait and landscape orientation the tabBar height would be138
and113
respectively. In portrait it has largertabBar
height than landscape, so behavior of the system is matched.Related:
#1144, #1150