8000 GitHub - heestand-xyz/Tabs: Tabs in SwiftUI
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

heestand-xyz/Tabs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
) { ... }

About

Tabs in SwiftUI

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

0