Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to adjust tabBar line width #1114

Merged
merged 1 commit into from Jul 9, 2018
Merged

Added option to adjust tabBar line width #1114

merged 1 commit into from Jul 9, 2018

Conversation

OrkhanAlikhanov
Copy link
Contributor

Added ability to tweak tab bar line width. #1109

public enum TabBarLineStyle {
  case auto
  case fixed(CGFloat)
  case custom((TabBarItem) -> CGFloat)
}

Usage

tabBar.tabBarLineStyle = .auto
tabBar.tabBarLineStyle = .fixed(100)
tabBar.tabBarLineStyle = .custom { tabItem in
    return tabItem.bounds.width - 20
  }


PS: My simulator stops rendering at some point until certain UI change is triggered, that's why it looks a bit laggy

@@ -205,6 +205,12 @@ public enum TabBarCenteringStyle {
case always
}

public enum TabBarLineStyle {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about naming


shouldNotAnimateLineView = false
}

func lineFrame(for tabItem: TabItem, forMotion: Bool = false) -> CGRect {
let y = .bottom == lineAlignment ? scrollView.bounds.height - (forMotion ? lineHeight / 2 : lineHeight) : (forMotion ? lineHeight / 2 : 0)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't understand the reason, but Motion requires center point? It feels counterintuitive.

Copy link
Member

@daniel-jonathan daniel-jonathan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great!

@daniel-jonathan daniel-jonathan merged commit dfa7b8a into CosmicMind:development Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants