Swiftpack.co - mpdifran/AdaptiveTabView as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by mpdifran.
mpdifran/AdaptiveTabView 0.4.0
An adaptive SwiftUI TabView that switches between TabView and NavigationSplitView.
⭐️ 2
🕓 2 weeks ago
iOS macOS tvOS
.package(url: "https://github.com/mpdifran/AdaptiveTabView.git", from: "0.4.0")

AdaptiveTabView

An adaptive SwiftUI container that switches between TabView and NavigationSplitView based on horiontal size class. This framework allows you to easily build iPhone and iPad apps that conform to Apple's Human Interface Guidelines.

iPhone iPad
Preview iPhone Preview iPad

Here's an example of how it can be used:

@main
struct MyApp: App {
    @State private var selectedTab = MyFirstTab.identifier

    var body: some Scene {
        WindowGroup {
            AdaptiveTabView(
                appName: "My App", 
                selectedTab: selectedTab
            ) {
                MyFirstTab()
                MySecondTab()
                MyThirdTab()
            } defaultContent: {
                MyDefaultContentView()
            } defaultDetail: {
                MyDefaultDetailView()
            } sidebarExtraContent: {
                Section {
                    ForEach(folders) { (folder) in
                        FolderSidebarCell(folder)
                    }
                }   
            }
        }
    }
}
extension MyFirstTab {
    static let identifier = TabIdentifier("MyFirstTab")
}

struct MyFirstTab: View, TitleImageProviding {
    let title = "My First Tab"
    let systemImageName = "1.square"
    let id = MyFirstTab.identifier

    var body: some View {
        ...
    }
}

GitHub

link
Stars: 2
Last commit: 2 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Dependencies

Release Notes

v0.4.0
2 weeks ago
  • Proper tab selection Binding
  • Added example project
  • Update README with images

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