Giter Club home page Giter Club logo

bekcurvetabbar's Introduction

BEKCurveTabbar

Full Customizable Tabbar with IBInspectables

CI Status License Platform

A fun replacement for UITabbar. The Component uses Bézier paths.

Demo

Example

usage:

You can change the appearance by using Xcode Interface Builder or by using the default config (recommended). BEKCurveTabbarController can be setup with your custom ViewModel that conforms to the BEKTabBarViewModelType protocol. you can set your 'tabbar' to BEKCurveTabbar inside Interface Builder or initiate it programatically in the easiest way possible like this:

Note: BEKCurveTabbarController initiates with .initiate()

Default Config Usage:

        //Initiate your viewControllers
        let firstViewController = UIViewController()
        firstViewController.view.backgroundColor = .red
        firstViewController.tabBarItem = UITabBarItem(tabBarSystemItem: .search, tag: 0)
        let secondViewController = UIViewController()
        firstViewController.view.backgroundColor = .white
        secondViewController.tabBarItem = UITabBarItem(tabBarSystemItem: .favorites, tag: 1)
        let thirdViewController = UIViewController()
        thirdViewController.view.backgroundColor = .blue
        thirdViewController.tabBarItem = UITabBarItem(tabBarSystemItem: .more, tag: 2)
        
        //get instance of BEKCurveTabbarController
        let tabBarViewController = BEKCurveTabbarController.instantiate()
        
        //set viewControllers to the tabbar
        tabBarViewController.setViewControllers([firstViewController, secondViewController, thirdViewController], animated: true)

Customized Config Usage:

Create a new struct that conforms to BEKTabBarViewModelType :

struct MyCustomTabBarViewModel: BEKTabBarViewModelType {
    let heightRatio: CGFloat = CGFloat(TabbarHeightRatios.bestSize.rawValue)
    let containerColor: UIColor = .white
    let hideTitle: Bool = false
    let animationDuration: CGFloat = 0.3
    let animated: Bool = true
    let shadowColor: UIColor = UIColor(red: 0.353, green: 0.784, blue: 1, alpha: 1.0)
    let shadowRadius: CGFloat = 16
    let containerBorderWidth: CGFloat = 1.0
    let containerBorderColor: UIColor = .gray
    let selectedTextColor: UIColor = .yellow
    let selectedTextFont: UIFont = .systemFont(ofSize: 13)
    let normalTextColor: UIColor = .lightGray
    let normalTextFont: UIFont = .systemFont(ofSize: 11)
    let topCornerRadius: CGFloat = TabbarHeightRatios.bestSize.cornerRadius()
    let bottomCornerRadius: CGFloat = 0
    let containerInsets: UIEdgeInsets = TabbarHeightRatios.bestSize.containerInsets()
    let selectionCircleRadius: CGFloat = TabbarHeightRatios.bestSize.circleRadius()
    let selectionCircleBorderWidth: CGFloat = 0.0
    let selectionCircleBorderColor: UIColor = .clear
    let selectionCircleBackgroundColor: UIColor = UIColor(red: 0.353, green: 0.784, blue: 1, alpha: 1.0)
    let textOffset: CGFloat = 0
    init() {}
}

Note: TabbarHeightRatios.bestSize provides you computed values for different iOS environments. (recommended)

Now you just need to pass your viewModel to .setupViewModel(viewModel: BEKTabBarViewModelType) function.

        //1- Initiate your viewControllers
        let firstViewController = UIViewController()
        firstViewController.view.backgroundColor = .red
        firstViewController.tabBarItem = UITabBarItem(tabBarSystemItem: .search, tag: 0)
        let secondViewController = UIViewController()
        firstViewController.view.backgroundColor = .white
        secondViewController.tabBarItem = UITabBarItem(tabBarSystemItem: .favorites, tag: 1)
        let thirdViewController = UIViewController()
        thirdViewController.view.backgroundColor = .blue
        thirdViewController.tabBarItem = UITabBarItem(tabBarSystemItem: .more, tag: 2)
        
        //2- get instance of BEKCurveTabbarController
        let tabBarViewController = BEKCurveTabbarController.instantiate()
        
        //3- Config your own TabBar ViewModel
        let myViewModel = MyCustomTabBarViewModel()
        
        //4- setup TabBar Controller with you viewModel
        tabBarViewController.setupViewModel(viewModel: myViewModel)
        
        //5- set viewControllers to the tabbar
        tabBarViewController.setViewControllers([firstViewController, secondViewController, thirdViewController], animated: true)
        return tabBarViewController

Installation

  pod 'BEKCurveTabbar', :git => 'https://github.com/behrad-kzm/BEKCurveTabbar.git'

Author

Behrad Kazemi, [email protected], bekapps.com Visit Web Site

License

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

bekcurvetabbar's People

Contributors

behrad-kzm avatar daliadanila avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bekcurvetabbar's Issues

Better example code

Your library seems amazing, but it would be helpful to have more code examples since there are a lot of developers who do not use the Interface Builder. You can use ESTabBarController as an example.

Configurable rounded corners individually !

Hi there, awesome component. I will use this everytime. But i have a problem, i need corner radius of this Tabbar to be configurable, like IBAnimatable did: https://github.com/IBAnimatable/IBAnimatable/blob/master/Documentation/APIs.md#cornerdesignable

For example, i need to implement a tabbar rounded topLeft and topRight but squared in bottomLeft and bottomRight. Is this possible @behrad-kzm ??

I exactly need to make this tabbar: https://www.cubacitas.app/wp-content/uploads/2019/09/mobil3.png, but this bar only have one property for all borders...

Swift Version !

Hi, awesome bar, this have support for swift 4 and/or 4.2. I´m begining a project and this component is perfect, but i´m using XCode 10 and Swift 4.2. When try to install the pod trow error for swift version i think.

What about badges?

I have set the badge on the element and it does not appear in the bar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.