Commit fa10e98d by Daniel Dahan

working copy of TabBar scrollable

parent d89f0976
......@@ -98,7 +98,6 @@
965E81211DD4D5C800D61E4B /* TextStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB79D1CB40DC500C806FE /* TextStorage.swift */; };
965E81221DD4D5C800D61E4B /* TextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB79E1CB40DC500C806FE /* TextView.swift */; };
965E81261DD4D7C800D61E4B /* CharacterAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = 961276621DCD8B1800A7D920 /* CharacterAttribute.swift */; };
966995491F1433C30064E7E4 /* PageTabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966995481F1433C30064E7E4 /* PageTabBarController.swift */; };
966C17731F0439F600D3E83C /* Material+MotionAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966C17721F0439F600D3E83C /* Material+MotionAnimation.swift */; };
9685D5AF1F0F04CB00AFEB79 /* CardCollectionViewCell.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9656895E1F002F16001C656D /* CardCollectionViewCell.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9685D5B01F0F04CB00AFEB79 /* CardCollectionViewController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 965689601F002F4C001C656D /* CardCollectionViewController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
......@@ -205,7 +204,6 @@
96E3C39A1D3A1CC20086A024 /* ErrorTextField.swift in Headers */ = {isa = PBXBuildFile; fileRef = 961F18E71CD93E3E008927C5 /* ErrorTextField.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96E3C39C1D3A1CC20086A024 /* Offset.swift in Headers */ = {isa = PBXBuildFile; fileRef = 968C99461D377849000074FF /* Offset.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96F1A5531F24F17A001D8CAF /* TabsController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96E09DC71F2287E50000B121 /* TabsController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96FE06C71F15348400E34953 /* PageTabBarController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 966995481F1433C30064E7E4 /* PageTabBarController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
......@@ -230,7 +228,6 @@
9656895E1F002F16001C656D /* CardCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CardCollectionViewCell.swift; sourceTree = "<group>"; };
965689601F002F4C001C656D /* CardCollectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CardCollectionViewController.swift; sourceTree = "<group>"; };
9658F2161CD6FA4700B902C1 /* IconButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IconButton.swift; sourceTree = "<group>"; };
966995481F1433C30064E7E4 /* PageTabBarController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PageTabBarController.swift; sourceTree = "<group>"; };
966C17721F0439F600D3E83C /* Material+MotionAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+MotionAnimation.swift"; sourceTree = "<group>"; };
966ECF291CF4C20100BB0BDF /* CollectionReusableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionReusableView.swift; sourceTree = "<group>"; };
967A48181D0F425A00B8CEB7 /* StatusBarController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusBarController.swift; sourceTree = "<group>"; };
......@@ -512,14 +509,6 @@
name = CardCollectionView;
sourceTree = "<group>";
};
966995471F1433640064E7E4 /* PageTabBar */ = {
isa = PBXGroup;
children = (
966995481F1433C30064E7E4 /* PageTabBarController.swift */,
);
name = PageTabBar;
sourceTree = "<group>";
};
966ECF2B1CF4C21B00BB0BDF /* Table */ = {
isa = PBXGroup;
children = (
......@@ -570,7 +559,6 @@
96BCB8041CB40F6C00C806FE /* Layout */,
96BCB8011CB40F1700C806FE /* Navigation */,
961E6BEF1DDA4B04004E6C93 /* NavigationDrawer */,
966995471F1433640064E7E4 /* PageTabBar */,
9626CA951DAB5370003E2611 /* Root */,
961E6BE01DDA2ADD004E6C93 /* Screen */,
963FBF031D6696EF008F8512 /* SearchBar */,
......@@ -926,7 +914,6 @@
9685D5AF1F0F04CB00AFEB79 /* CardCollectionViewCell.swift in Headers */,
9685D5B01F0F04CB00AFEB79 /* CardCollectionViewController.swift in Headers */,
9685D5B11F0F04CB00AFEB79 /* Material+MotionAnimation.swift in Headers */,
96FE06C71F15348400E34953 /* PageTabBarController.swift in Headers */,
96F1A5531F24F17A001D8CAF /* TabsController.swift in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
......@@ -1049,7 +1036,6 @@
965E811F1DD4D5C800D61E4B /* ErrorTextField.swift in Sources */,
965E81211DD4D5C800D61E4B /* TextStorage.swift in Sources */,
965E81221DD4D5C800D61E4B /* TextView.swift in Sources */,
966995491F1433C30064E7E4 /* PageTabBarController.swift in Sources */,
965E80E71DD4C55200D61E4B /* Material+UIView.swift in Sources */,
96DE3CD41F269BF00035F7AF /* MotionViewPropertyViewContext.swift in Sources */,
965E80E81DD4C55200D61E4B /* Material+CALayer.swift in Sources */,
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.7.0</string>
<string>2.8.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -59,7 +59,7 @@ public protocol TabBarDelegate {
@objc(TabBarStyle)
public enum TabBarStyle: Int {
case normal
case `default`
case scrollable
}
......@@ -78,7 +78,7 @@ open class TabBar: Bar {
}
/// An enum that determines the tab bar style.
open var tabBarStyle = TabBarStyle.scrollable {
open var tabBarStyle = TabBarStyle.default {
didSet {
layoutSubviews()
}
......@@ -325,23 +325,25 @@ open class TabBar: Bar {
open override func prepare() {
super.prepare()
contentEdgeInsetsPreset = .none
interimSpacePreset = .interimSpace5
interimSpacePreset = .interimSpace6
prepareContentView()
prepareScrollView()
prepareDivider()
prepareLine()
}
}
extension TabBar {
fileprivate extension TabBar {
// Prepares the line.
fileprivate func prepareLine() {
line.zPosition = 6000
func prepareLine() {
line.zPosition = 10000
lineColor = Color.blue.base
lineHeight = 3
}
/// Prepares the divider.
fileprivate func prepareDivider() {
func prepareDivider() {
dividerColor = Color.grey.lighten3
dividerAlignment = .top
}
......@@ -349,13 +351,18 @@ extension TabBar {
Prepares the line animation handlers.
- Parameter button: A UIButton.
*/
fileprivate func prepareLineAnimationHandler(button: UIButton) {
func prepareLineAnimationHandler(button: UIButton) {
removeLineAnimationHandler(button: button)
button.addTarget(self, action: #selector(handleLineAnimation(button:)), for: .touchUpInside)
}
/// Prepares the contentView.
func prepareContentView() {
contentView.zPosition = 6000
}
/// Prepares the scroll view.
fileprivate func prepareScrollView() {
func prepareScrollView() {
scrollView.isPagingEnabled = false
scrollView.showsVerticalScrollIndicator = false
scrollView.showsHorizontalScrollIndicator = false
......@@ -420,7 +427,7 @@ extension TabBar {
line.animate(.duration(0.25),
.size(CGSize(width: button.width, height: lineHeight)),
.position(CGPoint(x: button.center.x, y: .bottom == lineAlignment ? height - lineHeight : 0)),
.position(CGPoint(x: button.center.x, y: .bottom == lineAlignment ? height - lineHeight / 2 : lineHeight / 2)),
.completion { [weak self, isTriggeredByUserInteraction = isTriggeredByUserInteraction, button = button, completion = completion] _ in
guard let s = self else {
return
......
......@@ -32,7 +32,12 @@ import UIKit
fileprivate var TabItemKey: UInt8 = 0
open class TabItem: FlatButton {}
open class TabItem: FlatButton {
open override func prepare() {
super.prepare()
pulseAnimation = .none
}
}
@objc(TabBarAlignment)
public enum TabBarAlignment: Int {
......@@ -307,7 +312,7 @@ fileprivate extension TabsController {
fileprivate extension TabsController {
/**
Handles the pageTabBarButton.
Handles the tabItem.
- Parameter button: A UIButton.
*/
@objc
......
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