目录
目录README.md

SwiftUI VerticalTabView 🔝

VTabView is a native way to display paged vertical content in SwiftUI.

To work it makes use of the new iOS 14 TabView PageTabViewStyle.

Usage

Use like any other TabView:

import SwiftUI
import VTabView

VTabView {
    Text("The First Tab")
        .tabItem {
            Image(systemName: "square.fill")
        }
    Text("Another Tab")
        .tabItem {
            Image(systemName: "circle.fill")
        }
    Text("The Last Tab")
        .tabItem {
            Image(systemName: "triangle.fill")
        }
}
.tabViewStyle(PageTabViewStyle())

You can also move index to the right

VTabView(indexPosition: .trailing) {
    ...
}
.tabViewStyle(PageTabViewStyle())

or remove it

VTabView {
    ...
}
.tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))

Limitation

TabView bounces in all directions by default.

VTabView is meant to be used with .tabViewStyle(PageTabViewStyle()) but you can also use DefaultTabViewStyle. Only remember that tab items will not have the orientation you would probably like to obtain. A workaround for this would be in tabItem to not use Text but only an Image correctly transformed.

Installation

  1. In Xcode, open your project and navigate to FileSwift PackagesAdd Package Dependency…
  2. Paste the repository URL (https://github.com/lorenzofiamingo/swiftui-vertical-tab-view) and click Next.
  3. Click Finish.

Other projects

SwiftUI AsyncButton 🖲️

SwiftUI MapItemPicker 🗺️

SwiftUI PhotosPicker 🌇

SwiftUI CachedAsyncImage 🗃️

SwiftUI SharedObject 🍱

关于
45.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号