84

GitHub - Ahmadalsofi/SOTabBar: Light way to add Fancy bottom bar 📲

 4 years ago
source link: https://github.com/Ahmadalsofi/SOTabBar
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

SOTabBar

68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f41686d6164616c736f66692f534f5461624261722e7376673f7374796c653d666c6174 68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53776966742d34207c20352d6f72616e67652e7376673f7374796c653d666c6174 CocoaPods Platforms 68747470733a2f2f696d672e736869656c64732e696f2f62616467652f43617274686167652d636f6d70617469626c652d3442433531442e7376673f7374796c653d666c6174 68747470733a2f2f696d672e736869656c64732e696f2f636f636f61706f64732f6c2f534f5461624261722e7376673f7374796c653d666c6174 68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f61686d6164616c736f66692f534f5461624261722e737667 68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d7261772f61686d6164616c736f66692f736f746162626172 68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652d646174652f61686d6164616c736f66692f736f746162626172



headerGif.gif

📋 Requirements

SOTabBar requires iOS 9.3 or above, and is compatibile with Swift 4/5.

📲 Installation

CocoaPods

SOTabBar is available through CocoaPods:

pod 'SOTabBar'

Carthage

SOTabBar is also available through Carthage:

github "Ahmadalsofi/SOTabBar"

🚀 Usage

The Basics

  1. Set up your view controller with the an array of view controllers that you want to appear.
  2. Make your main View Controller subclass from SOTabBarViewController.
  3. return the array of your ViewControllers:
import UIKit
import SOTabBar
class MainViewController: SOTabBarViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        let firstVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "First_ID")
        let secondVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "Second_ID")
       
        firstVC.tabBarItem = UITabBarItem(title: "Home", image: UIImage(named: "firstImage"), selectedImage: UIImage(named: "firstSelectedImage"))
        secondVC.tabBarItem = UITabBarItem(title: "Chat", image: UIImage(named: "secondImage"), selectedImage: UIImage(named: "secondSelectedImage"))
	
        viewControllers = [firstVC, secondVC]
    }
}
  1. you can trigger your tab bar action by override the following function in your MainViewController
 override func soTabBar(_ tabBar: SOTabBarView, didSelectTabAt index: Int) {
      print("did Tapped On \(index)")
  }

🎨 Customization

You should set your customization before return the array of the viewcontrollers

class MainViewController: SOTabBarViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // write here your customization before return the array

	SOTabBarSetting.Properties of  Customized = value

        let firstVC = FirstVC()
        viewControllers = [firstVC]
    }
}

tabBarHeight

    SOTabBarSetting.tabBarHeight = 100.0

tabBarHeight.png

tabBarTintColor

    SOTabBarSetting.tabBarTintColor = UIColor.red

tabBarTintColor.png

tabBarBackground

    SOTabBarSetting.tabBarBackground = UIColor.purple

tabBarBackground.png

tabBarCircleSize

    SOTabBarSetting.tabBarCircleSize = CGSize(width: 50.0, height: 50.0)
  	 // or 
    SOTabBarSetting.tabBarCircleSize = CGSize(width: 80.0, height: 80.0)

tabBarCircleSize_50.png tabBarCircleSize_80.png

tabBarSizeImage

    SOTabBarSetting.tabBarSizeImage = CGSize(width: 40.0, height: 40.0)

tabBarSizeImage_40.png

tabBarShadowColor

    SOTabBarSetting.tabBarShadowColor = UIColor.red.cgcolor

tabBarShadowColor_red.png

tabBarSizeSelectedImage

    SOTabBarSetting.tabBarSizeSelectedImage = CGSize(width: 40.0, height: 40.0)

tabBarSizeSelectedImage_40.png

tabBarAnimationDurationTime

    SOTabBarSetting.tabBarAnimationDurationTime = 2

tabBarAnimationDurationTime_2.gif

👨🏻‍💻 Author

❤️ Contributing

Bug reports and pull requests are welcome on GitHub

👮🏻‍♂️ License

The library is available as open source under the terms of the MIT License.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK