-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# AdaptiveTabView | ||
|
||
An adaptive SwiftUI container that switches between [TabView](https://developer.apple.com/design/human-interface-guidelines/components/navigation-and-search/tab-bars) and [NavigationSplitView](https://developer.apple.com/design/human-interface-guidelines/components/layout-and-organization/split-views) based on horiontal size class. This framework allows you to easily build iPhone and iPad apps that conform to [Apple's Human Interface Guidelines](https://developer.apple.com/design/). | ||
|
||
Here's an example of how it can be used: | ||
|
||
```swift | ||
@main | ||
struct MyApp: App { | ||
var body: some Scene { | ||
WindowGroup { | ||
AdaptiveTabView(appName: "My App") { | ||
MyFirstTab() | ||
MySecondTab() | ||
MyThirdTab() | ||
} defaultContent: { | ||
MyDefaultContentView() | ||
} defaultDetail: { | ||
MyDefaultDetailView() | ||
} sidebarExtraContent: { | ||
Section { | ||
ForEach(folders) { (folder) in | ||
FolderSidebarCell(folder) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
```swift | ||
struct MyFirstTab: View, TitleImageProviding { | ||
let title = "My First Tab" | ||
let systemImageName = "1.square" | ||
|
||
var body: some View { | ||
... | ||
} | ||
} | ||
``` |