/Tabify

A SwiftUI view that elegantly utilizes interactive user interface elements to dynamically switch between multiple child views.

Primary LanguageSwiftMIT LicenseMIT

Contributors Forks Stargazers Issues MIT License LinkedIn

tabify_banner

Table of contents

Description

Tabify is a SwiftUI view that elegantly utilizes interactive user interface elements to dynamically switch between multiple child views. It is highly customizable and, due to its similarity to the native TabView SwiftUI component, very user-friendly and easy to use.

Requirements

  • SwiftUI
  • iOS 13.0 or above

(back to top)

Installation

Swift Package Manager

The preferred way of installing Tabify is via the Swift Package Manager.

  1. In Xcode, open your project and navigate to FileAdd Packages
  2. Paste the repository URL (https://github.com/bgeisb/Tabify.git) and click Next.
  3. For Rules, select Up to Next Major Version.
  4. Click Add Package.

CocoaPods

⏳ Coming soon...

(back to top)

Usage

1. Create TabifyItems Enum

Make sure your enum implements the TabifyItem protocol.

enum TabifyItems: Int, TabifyItem {
    case home = 0
    case search
    case profile
    
    var icon: String {
        switch self {
            case .home: return "house"
            case .search: return "magnifyingglass"
            case .profile: return "person"
        }
    }
    
    var title: String {
        switch self {
            case .home: return "Home"
            case .search: return "Search"
            case .profile: return "Profile"
        }
    }
}

2. Add Tabify View

Tabify(selectedItem: $tabBarSelection) {
    Text("Home")
    .tabItem(for: TabifyItems.first)

    Text("Search")
    .tabItem(for: TabifyItems.second)

    Text("Profile")
    .tabItem(for: TabifyItems.third)
}
/* This following modifiers are optional. You can use them to inject your custom bar and item styling. */
.barStyle(style: CustomTabifyBarStyle())
.itemStyle(style: CustomTabifyItemStyle())

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)