Swiftpack.co - zhouhao27/TopTabView as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by zhouhao27.
zhouhao27/TopTabView 1.0.1
SwiftUI TabView whose's tabs on the top
⭐️ 3
🕓 4 years ago
iOS
.package(url: "https://github.com/zhouhao27/TopTabView.git", from: "1.0.1")

TopTabView

A SwiftUI TopTabView component which shows Tab on top.

Screenshot

Installation

Install through Swift Package Manager.

Example

Example 1:

import TopTabView

struct ContentView: View {
  @State var selectedSegment = 0
    
  var body: some View {
    return TopTabView(items: [
      TopTabView.Item(title: "Arrow up", icon: Image(systemName:"square.and.arrow.up")),
      TopTabView.Item(title: "Folder", icon: Image(systemName:"folder.badge.plus")),
      TopTabView.Item(title: "Trash", icon: Image(systemName:"trash"))
      ], selection: $selectedSegment, onSelected:  {
        index in
        self.selectedSegment = index
    }) {
      if self.selectedSegment == 0 {
        VStack {
          Text("Tab 1")
        }
      } else if self.selectedSegment == 1 {
        VStack {
          Text("Tab 2")
        }
      } else {
        VStack {
          Text("Tab 3")
        }
      }
    }
  }
}

TODO:

  1. Make it similar with TabView

GitHub

link
Stars: 3
Last commit: 4 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

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