Commit 926d4bbd by Daniel Dahan

pr-1114: adjustments to TabBarCenteringStyle values and preparation for release 2.16.2

parent dfa7b8ab
## 2.16.2
* [pr-1113](https://github.com/CosmicMind/Material/pull/1113): Added update() to Grid.
* [pr-1112](https://github.com/CosmicMind/Material/pull/1112): Added tab bar centering.
* [issue-926](https://github.com/CosmicMind/Material/issues/926): TabsController - centering TabItem after selection.
* [pr-1114](https://github.com/CosmicMind/Material/pull/1114): Added option to adjust tabBar line width.
* [issue-1109](https://github.com/CosmicMind/Material/issues/1109): Want to change TabBar line width.
## 2.16.1 ## 2.16.1
* [issue-1110](https://github.com/CosmicMind/Material/issues/1110): Fixed an issue where the depth of a view was being clipped from incorrectly. * [issue-1110](https://github.com/CosmicMind/Material/issues/1110): Fixed an issue where the depth of a view was being clipped incorrectly.
* [pr-1111](https://github.com/CosmicMind/Material/pull/1111): Fixed TabItem - was not being changed on swipe.
* [pr-1106](https://github.com/CosmicMind/Material/pull/1106): Added ability to show visibility and clear button at the same time.
* [issue-992](https://github.com/CosmicMind/Material/issues/992): Visibility & Clear Button can't be shown in TextField at the same time.
* [pr-1104](https://github.com/CosmicMind/Material/pull/1104): Added missing devices.
* [pr-1101](https://github.com/CosmicMind/Material/pull/1101): Enum for support iPhoneX.
## 2.16.0 ## 2.16.0
...@@ -30,6 +43,8 @@ ...@@ -30,6 +43,8 @@
* [pr-1097](https://github.com/CosmicMind/Material/pull/1097):: Added new extensions: UIColor(argb:), UIColor(rgb:), UIButton.fontSize, UILabel.fontSize. * [pr-1097](https://github.com/CosmicMind/Material/pull/1097):: Added new extensions: UIColor(argb:), UIColor(rgb:), UIButton.fontSize, UILabel.fontSize.
* [pr-1093](https://github.com/CosmicMind/Material/pull/1093):: Fix TextField placeholderLabel position. * [pr-1093](https://github.com/CosmicMind/Material/pull/1093):: Fix TextField placeholderLabel position.
* [issue-1092](https://github.com/CosmicMind/Material/issues/1092): TextField.placeholderLabel is positioned higher than before in version 2.x.x. * [issue-1092](https://github.com/CosmicMind/Material/issues/1092): TextField.placeholderLabel is positioned higher than before in version 2.x.x.
* [pr-1103](https://github.com/CosmicMind/Material/pull/1103): Added ability to change password visibility icons.
* [issue-1012](https://github.com/CosmicMind/Material/issues/1012): Can we set visibility icon custom for password textfield.
## 2.15.0 ## 2.15.0
......
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Material' s.name = 'Material'
s.version = '2.16.1' s.version = '2.16.2'
s.swift_version = '4.0' s.swift_version = '4.0'
s.license = 'BSD-3-Clause' s.license = 'BSD-3-Clause'
s.summary = 'A UI/UX framework for creating beautiful applications.' s.summary = 'A UI/UX framework for creating beautiful applications.'
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>2.16.1</string> <string>2.16.2</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -201,7 +201,7 @@ public enum TabBarStyle: Int { ...@@ -201,7 +201,7 @@ public enum TabBarStyle: Int {
public enum TabBarCenteringStyle { public enum TabBarCenteringStyle {
case never case never
case whenNeeded case auto
case always case always
} }
...@@ -243,7 +243,7 @@ open class TabBar: Bar { ...@@ -243,7 +243,7 @@ open class TabBar: Bar {
} }
/// An enum that determines the tab bar centering style. /// An enum that determines the tab bar centering style.
open var tabBarCenteringStyle = TabBarCenteringStyle.never { open var tabBarCenteringStyle = TabBarCenteringStyle.always {
didSet { didSet {
layoutSubviews() layoutSubviews()
} }
...@@ -513,6 +513,7 @@ fileprivate extension TabBar { ...@@ -513,6 +513,7 @@ fileprivate extension TabBar {
func lineFrame(for tabItem: TabItem, forMotion: Bool = false) -> CGRect { func lineFrame(for tabItem: TabItem, forMotion: Bool = false) -> CGRect {
let y = .bottom == lineAlignment ? scrollView.bounds.height - (forMotion ? lineHeight / 2 : lineHeight) : (forMotion ? lineHeight / 2 : 0) let y = .bottom == lineAlignment ? scrollView.bounds.height - (forMotion ? lineHeight / 2 : lineHeight) : (forMotion ? lineHeight / 2 : 0)
let w: CGFloat = { let w: CGFloat = {
switch tabBarLineStyle { switch tabBarLineStyle {
case .auto: case .auto:
...@@ -525,7 +526,9 @@ fileprivate extension TabBar { ...@@ -525,7 +526,9 @@ fileprivate extension TabBar {
return closure(tabItem) return closure(tabItem)
} }
}() }()
let x = forMotion ? tabItem.center.x : (tabItem.frame.origin.x + (tabItem.bounds.width - w) / 2) let x = forMotion ? tabItem.center.x : (tabItem.frame.origin.x + (tabItem.bounds.width - w) / 2)
return CGRect(x: x, y: y, width: w, height: lineHeight) return CGRect(x: x, y: y, width: w, height: lineHeight)
} }
} }
...@@ -645,6 +648,7 @@ fileprivate extension TabBar { ...@@ -645,6 +648,7 @@ fileprivate extension TabBar {
selectedTabItem = tabItem selectedTabItem = tabItem
let f = lineFrame(for: tabItem, forMotion: true) let f = lineFrame(for: tabItem, forMotion: true)
line.animate(.duration(0.25), line.animate(.duration(0.25),
.size(f.size), .size(f.size),
.position(f.origin), .position(f.origin),
...@@ -675,17 +679,21 @@ fileprivate extension TabBar { ...@@ -675,17 +679,21 @@ fileprivate extension TabBar {
let shouldScroll = !scrollView.bounds.contains(v.frame) let shouldScroll = !scrollView.bounds.contains(v.frame)
switch tabBarCenteringStyle { switch tabBarCenteringStyle {
case .whenNeeded: case .auto:
guard shouldScroll else { guard shouldScroll else {
return nil return nil
} }
fallthrough fallthrough
case .always: case .always:
return v.center.x - bounds.width / 2 return v.center.x - bounds.width / 2
case .never: case .never:
guard shouldScroll else { guard shouldScroll else {
return nil return nil
} }
return v.frame.origin.x < scrollView.bounds.minX ? v.frame.origin.x : v.frame.maxX - scrollView.bounds.width return v.frame.origin.x < scrollView.bounds.minX ? v.frame.origin.x : v.frame.maxX - scrollView.bounds.width
} }
}() }()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment