Swiftpack.co -  eshwavin/SETabView as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
eshwavin/SETabView
SETabView is a TabBar with simple yet beautiful animations that makes your apps look cool!
.package(url: "https://github.com/eshwavin/SETabView.git", from: "1.3.0")

CI Status Version License Platform

Animations

.holeBall1 .holeBall2 .holeBall3

Requirements

  • Swift 5+
  • iOS 11.0+
  • Swift tools version 5.0+ (For Swift Package Manager)

Integration

CocoaPods

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

pod 'SETabView'

In case the latest version (1.3.0) is not the one being installed, update the pod.

pod update 'SETabView'

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.

Once you have your Swift package set up, adding SETabView as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
.package(url: "https://github.com/eshwavin/SETabView.git", .upToNextMajor(from: "1.3.0"))
]

Directly include source files

Download and add the files in the Source folder directly into your Xcode Project. In this case you should skip

import SETabView

in the usage instructions.

Usage and Customization

Import SETabView into the parent view controller and any child view controllers

import SETabView

Inherit the SEViewController class in the parent view controller

class ViewController: SEViewController {

   override func viewDidLoad() {
    super.viewDidLoad()

  }
}

In viewDidLoad of the parent view controller, customise your tab bar look and set the child view controllers.

Set the view controllers using setViewControllers(_ viewControllers: [UIViewController], initialSelectedTabIndex: Int, animationType: AnimationType) method.

Customise the look by calling setTabSettings(tabColor: UIColor, ballColor: UIColor, selectedTabTintColor: UIColor, deselectedTabTintColor: UIColor, animationDuration: Double) method.

Make sure to call setTabSettings before setting your view controllers for the customisation to apply

class ViewController: SEViewController {
    
    override func viewDidLoad() {
      super.viewDidLoad()
      
      // set tab bar look
      setTabSettings(tabColor: UIColor.black, ballColor: UIColor.black, selectedTabTintColor: UIColor.white, deselectedTabTintColor: UIColor.gray, animationDuration: 1)
      
      // set the viwe controllers
      setViewControllers(getViewControllers(), initialSelectedTabIndex: 0, animationType: .holeBall3)

    }

    private func getViewControllers() -> [UIViewController] {
        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        
        return [
            storyboard.instantiateViewController(withIdentifier: "firstVC"),
            storyboard.instantiateViewController(withIdentifier: "secondVC"),
            storyboard.instantiateViewController(withIdentifier: "thirdVC"),
            storyboard.instantiateViewController(withIdentifier: "fourthVC"),
            storyboard.instantiateViewController(withIdentifier: "fifthVC")
        ]
    }   
}

The child view controllers need to conform to the SETabItem protocol. Using tabImage return the image you want as the icon for the tab for that view controller.

class FirstViewController: UIViewController, SETabItem {

    var tabImage: UIImage? {
        return UIImage(named: "first")
    }

    override func viewDidLoad() {
        super.viewDidLoad()
    }
}

The selected tab can be changed programmatically

self.selectedTabIndex = 3

Restrictions

  • Max 5 Tabs
  • Tab Bar look cannot be changed once set in setTabSettings()

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Author

Srivinayak Chaitanya Eshwa, eshwavin@gmail.com

License

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

Acknowledgement

Animation Inspiration

Icons

GitHub

link
Stars: 50
Last commit: 4 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

v1.3.0
4 weeks ago

Fixed versioning issues

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics