Swiftpack.co - heestand-xyz/Tabs as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by heestand-xyz.
heestand-xyz/Tabs 1.0.1
Tabs in SwiftUI
⭐️ 12
🕓 10 weeks ago
iOS macOS
.package(url: "https://github.com/heestand-xyz/Tabs.git", from: "1.0.1")

Tabs

Tabs built in SwiftUI for iOS and macOS.

Move and close tabs in UI. Open tabs via binding. Style via content callback.

Swift Package

.package(url: "https://github.com/heestand-xyz/Tabs", from: "1.0.0")

Setup

var body: some View {
   
    Tabs(openIDs: $openIDs,
         activeID: $activeID) { value in
        
        if let thing = things.first(where: { $0.id == value.id }) {
        
            ZStack {
                
                if isActive {
                    Color.accentColor.opacity(0.75)
                } else {
                    Color.primary.opacity(0.1)
                }
                
                Label {
                    Text(thing.name)
                } icon: {
                    Image(systemName: "circle")
                }
                .padding(.horizontal, value.height)
            }
            .help(thing.name)
        }
    }
}

Constructor

public init(
    openIDs: Binding<[UUID]>,
    activeID: Binding<UUID?>,
    spacing: CGFloat = .tabSpacing,
    width: CGFloat? = nil,
    height: CGFloat = CGSize.tabSize.height,
    @ViewBuilder content: @escaping (Tabs.Value) -> Content
) { ... }

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