Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

📱 TabBar – highly customizable tab bar (i.e. TabView) for your SwiftUI application.

License

NotificationsYou must be signed in to change notification settings

winddpan/TabBar

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftUI standardTabView component is not so flexible and to customize it you have to modify appearance proxy ofUITabBar or implement your own one from scratch. The goal of this library is to solve this problem.

Table of contents

Requirements

  • SwiftUI
  • iOS 13.0 or above

Installation

TabBar is available throughSwift Package Manager

Swift Package Manager

  • In Xcode select:

    File > Swift Packages > Add Package Dependency...
  • Then paste this URL:

    https://github.com/onl1ner/TabBar.git

Usage

To start usingTabBar you have to create an enum which will implementTabbable protocol:

enumItem:Int,Tabbable{case first=0case secondcase thirdvaricon:String{switchself{case.first:  // Name of icon of first item.            case.second: // Name of icon of second item.case.third:  // Name of icon of third item.}}vartitle:String{switchself{case.first:  // Title of first item.            case.second: // Title of second item.case.third:  // Title of third item.}}}

After that you will be able to createTabBar instance:

structContentView:View{@Stateprivatevarselection:Item=.first@Stateprivatevarvisibility:TabBarVisibility=.visiblevarbody:someView{TabBar(selection: $selection, visibility: $visibility){Text("First").tabItem(for:Item.first)Text("Second").tabItem(for:Item.second)Text("Third").tabItem(for:Item.third)}.tabBar(style:CustomTabBarStyle()).tabItem(style:CustomTabItemStyle())}}

After these actions tab bar with default style will be created.

Customization

TabBar component is highly customizable. This is achieved by introducingTabBarStyle andTabItemStyle protocols. By implementing each of the protocol you will be able to build your custom tab bar.NOTE thatTabBar automaticaly pushes down to bottom any of tab bar styles.

After creating your custom styles you may inject them to your tab bar by usingtabBar(style:) andtabItem(style:) functions. Here is the showcase of default style and one of the examples of what you can achieve by customizing tab bar:

Contribution

If you struggle with something feel free toopen an issue. Pull requests are also appreciated.

License

TabBar is under the terms and conditions of the MIT license.

MIT LicenseCopyright (c) 2021 Tamerlan SatualdypovPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.

About

📱 TabBar – highly customizable tab bar (i.e. TabView) for your SwiftUI application.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift100.0%

[8]ページ先頭

©2009-2025 Movatter.jp