项目作者: SimformSolutionsPvtLtd

项目描述 :
Simple Animated tabbar with native control
高级语言: Swift
项目地址: git://github.com/SimformSolutionsPvtLtd/SSCustomTabbar.git
创建时间: 2019-03-28T11:50:26Z
项目社区:https://github.com/SimformSolutionsPvtLtd/SSCustomTabbar

开源协议:MIT License

下载


SSCustomTabbar

Simple Animated tabbar with native control.

Version
License
Platform
Swift Version
PRs Welcome

Example

Example

Requirements

  • iOS 11.0+
  • Xcode 10.0+

Installation

SSCustomTabbar doesn’t contain any external dependencies.

It is available through CocoaPods. To install
it, simply add the following line to your Podfile:

  1. pod 'SSCustomTabbar'

UIKit Usage example

Set UITabbarController to SSCustomTabBarViewController

alt text

Set UITabBar to SSCustomTabBar

alt text

Set UITabBar to SSCustomTabBar reverse curve

alt text

SwiftUI Usage example

  1. struct TabItem: View {
  2. var text: String
  3. @State var isNextActive: Bool = false
  4. @Binding var isTabBarHidden: Bool
  5. var body: some View {
  6. NavigationView {
  7. ZStack {
  8. NavigationLink(destination: PushedView(isTabBarHidden: self.$isTabBarHidden, showPushedView: self.$isNextActive), isActive: self.$isNextActive) {
  9. EmptyView()
  10. }
  11. VStack(spacing: 30) {
  12. Button(action: {
  13. self.isNextActive = true
  14. }) {
  15. Text("Tap to Push")
  16. }
  17. }
  18. }.onAppear {
  19. self.isTabBarHidden = false
  20. }
  21. }
  22. }
  23. }
  24. struct ContentView: View {
  25. @State var isTabBarHidden: Bool = false
  26. var body: some View {
  27. tabView
  28. .onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
  29. SwiftUITabBarController.refreshViews()
  30. }
  31. }
  32. var tabView: some View {
  33. let vc1 = SwiftUITabView(content: UIHostingController(rootView: TabItem(text: "Home", isTabBarHidden: self.$isTabBarHidden)), title: "Home", selectedImage: "iconHomeSelected", unSelectedImage: "iconHome")
  34. let vc2 = SwiftUITabView(content: UIHostingController(rootView: TabItem(text: "Favorite", isTabBarHidden: self.$isTabBarHidden)), title: "Favorite", selectedImage: "iconFavoriteSelected", unSelectedImage: "iconFavorite")
  35. let vc3 = SwiftUITabView(content: UIHostingController(rootView: TabItem(text: "Video", isTabBarHidden: self.$isTabBarHidden)), title: "Video", selectedImage: "iconVideoSelected", unSelectedImage: "iconVideo")
  36. let vc4 = SwiftUITabView(content: UIHostingController(rootView: TabItem(text: "Profile", isTabBarHidden: self.$isTabBarHidden)), title: "Profile", selectedImage: "iconProfileSelected", unSelectedImage: "iconProfile")
  37. let vc5 = SwiftUITabView(content: UIHostingController(rootView: TabItem(text: "Chat", isTabBarHidden: self.$isTabBarHidden)), title: "Chat", selectedImage: "iconChatSelected", unSelectedImage: "iconChat")
  38. let tabBarView = SwiftUITabBarController(tabItems: [vc1, vc2, vc3, vc4, vc5], configuration: .constant(SSTabConfiguration()), isTabBarHidden: self.$isTabBarHidden)
  39. return tabBarView
  40. }
  41. }

Customization

You can change:

  • BarHeight
  • UnSelected item tint color
  • Wave Height
  • Animation point(Position)
  • Layer background color

alt text

alt text

alt text

Adding Badge value

alt text

Add/Update badge value:

  1. let tabBarController = self.tabBarController as? SSCustomTabBarViewController
  2. tabBarController?.addOrUpdateBadgeValueAtIndex(index: 0, value: "Your Value Here")

Remove badge value:

  1. let tabBarController = self.tabBarController as? SSCustomTabBarViewController
  2. tabBarController?.removeBadgeValueAtIndex(index: 1)

Remove all badge values:

  1. let tabBarController = self.tabBarController as? SSCustomTabBarViewController
  2. tabBarController?.removeAllBadges()

Contribute

We would love you for the contribution to SSCustomTabMenu, check the LICENSE file for more info.

Android Library.

  • Check our Android Library also on Github

Check out our other Libraries

🗂 Simform Solutions Libraries→

License

SSCustomTabbar is available under the MIT license. See the LICENSE file for more info.