-
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
23 changed files
with
768 additions
and
13 deletions.
There are no files selected for viewing
406 changes: 406 additions & 0 deletions
406
Example/AdaptiveTabExample/AdaptiveTabExample.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...ptiveTabExample/AdaptiveTabExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...le/AdaptiveTabExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
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,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
14 changes: 14 additions & 0 deletions
14
...le/AdaptiveTabExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
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,14 @@ | ||
{ | ||
"pins" : [ | ||
{ | ||
"identity" : "sequencebuilder", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/andtie/SequenceBuilder.git", | ||
"state" : { | ||
"revision" : "54d3d1eff31a7e35122f616840fff11899ea85b4", | ||
"version" : "0.0.7" | ||
} | ||
} | ||
], | ||
"version" : 2 | ||
} |
32 changes: 32 additions & 0 deletions
32
Example/AdaptiveTabExample/AdaptiveTabExample/AdaptiveTabExampleApp.swift
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,32 @@ | ||
// | ||
// AdaptiveTabExampleApp.swift | ||
// AdaptiveTabExample | ||
// | ||
// Created by Mark DiFranco on 2023-03-11. | ||
// | ||
|
||
import SwiftUI | ||
import AdaptiveTabView | ||
|
||
@main | ||
struct AdaptiveTabExampleApp: App { | ||
@State private var selectedTab = iPhoneTabView.identifier | ||
|
||
var body: some Scene { | ||
WindowGroup { | ||
AdaptiveTabView( | ||
appName: "Example", | ||
selectedTab: $selectedTab | ||
) { (containerKind) in | ||
MacOSTabView() | ||
iPhoneTabView() | ||
AppleWatchTabView() | ||
} defaultDetail: { | ||
ContentView(title: "Empty Details") | ||
} sidebarExtraContent: { | ||
SidebarView() | ||
} | ||
.navigationSplitViewStyle(.automatic) | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
.../AdaptiveTabExample/AdaptiveTabExample/Assets.xcassets/AccentColor.colorset/Contents.json
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,11 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...le/AdaptiveTabExample/AdaptiveTabExample/Assets.xcassets/AppIcon.appiconset/Contents.json
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,13 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"platform" : "ios", | ||
"size" : "1024x1024" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
Example/AdaptiveTabExample/AdaptiveTabExample/Assets.xcassets/Contents.json
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,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
Example/AdaptiveTabExample/AdaptiveTabExample/ContentView.swift
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,23 @@ | ||
// | ||
// ContentView.swift | ||
// AdaptiveTabExample | ||
// | ||
// Created by Mark DiFranco on 2023-03-12. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct ContentView: View { | ||
let title: String | ||
|
||
var body: some View { | ||
Text(title) | ||
.navigationTitle(title) | ||
} | ||
} | ||
|
||
struct ContentView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
ContentView(title: "Hello World") | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...aptiveTabExample/AdaptiveTabExample/Preview Content/Preview Assets.xcassets/Contents.json
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,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
Example/AdaptiveTabExample/AdaptiveTabExample/Sidebar/SidebarView.swift
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,34 @@ | ||
// | ||
// SidebarView.swift | ||
// AdaptiveTabExample | ||
// | ||
// Created by Mark DiFranco on 2023-03-13. | ||
// | ||
|
||
import SwiftUI | ||
import AdaptiveTabView | ||
|
||
struct SidebarView: View { | ||
let identifiers = [1, 2, 3, 4, 5] | ||
|
||
var body: some View { | ||
Group { | ||
Section("Folders") { | ||
ForEach(identifiers, id: \.self) { (identifier) in | ||
NavigationLink { | ||
ContentView(title: "Folder \(identifier)") | ||
} label: { | ||
Label("Folder \(identifier)", systemImage: "folder") | ||
} | ||
.tag(TabIdentifier("Folder\(identifier)")) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
struct SidebarView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
SidebarView() | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
Example/AdaptiveTabExample/AdaptiveTabExample/Tabs/AppleWatchTabView.swift
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 @@ | ||
// | ||
// AppleWatchTabView.swift | ||
// AdaptiveTabExample | ||
// | ||
// Created by Mark DiFranco on 2023-03-11. | ||
// | ||
|
||
import SwiftUI | ||
import AdaptiveTabView | ||
|
||
extension AppleWatchTabView { | ||
static let identifier = TabIdentifier("AppleWatchTabView") | ||
} | ||
|
||
struct AppleWatchTabView: View, TitleImageProviding { | ||
let title = "Apple Watches" | ||
let systemImageName = "applewatch" | ||
let id = AppleWatchTabView.identifier | ||
|
||
private let watches = [ | ||
"Apple Watch SE", | ||
"Apple Watch Ultra", | ||
"Apple Watch Series 8", | ||
"Apple Watch Series 7" | ||
] | ||
|
||
var body: some View { | ||
List(watches, id: \.self) { (watch) in | ||
NavigationLink(watch) { | ||
ContentView(title: watch) | ||
} | ||
} | ||
.listStyle(.insetGrouped) | ||
} | ||
} | ||
|
||
struct AppleWatchTabView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
AppleWatchTabView() | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
Example/AdaptiveTabExample/AdaptiveTabExample/Tabs/MacOSTabView.swift
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,42 @@ | ||
// | ||
// MacOSTabView.swift | ||
// AdaptiveTabExample | ||
// | ||
// Created by Mark DiFranco on 2023-03-11. | ||
// | ||
|
||
import SwiftUI | ||
import AdaptiveTabView | ||
|
||
extension MacOSTabView { | ||
static let identifier = TabIdentifier("MacOSTabView") | ||
} | ||
|
||
struct MacOSTabView: View, TitleImageProviding { | ||
let title = "macOS Versions" | ||
let systemImageName = "laptopcomputer" | ||
let id = MacOSTabView.identifier | ||
|
||
private let versions = [ | ||
"Ventura", | ||
"Monterey", | ||
"Big Sur", | ||
"Catalina", | ||
"Mojave" | ||
] | ||
|
||
var body: some View { | ||
List(versions, id: \.self) { (version) in | ||
NavigationLink(version) { | ||
ContentView(title: version) | ||
} | ||
} | ||
.listStyle(.insetGrouped) | ||
} | ||
} | ||
|
||
struct FirstTabView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
MacOSTabView() | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
Example/AdaptiveTabExample/AdaptiveTabExample/Tabs/iPhoneTabView.swift
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 @@ | ||
// | ||
// iPhoneTabView.swift | ||
// AdaptiveTabExample | ||
// | ||
// Created by Mark DiFranco on 2023-03-11. | ||
// | ||
|
||
import SwiftUI | ||
import AdaptiveTabView | ||
|
||
extension iPhoneTabView { | ||
static let identifier = TabIdentifier("iPhoneTabView") | ||
} | ||
|
||
struct iPhoneTabView: View, TitleImageProviding { | ||
let title = "iPhones" | ||
let systemImageName = "iphone" | ||
let id = iPhoneTabView.identifier | ||
|
||
private let phones = [ | ||
"iPhone 14 Pro Max", | ||
"iPhone 13 mini", | ||
"iPhone 12 Pro", | ||
"iPhone 11" | ||
] | ||
|
||
var body: some View { | ||
List(phones, id: \.self) { (phone) in | ||
NavigationLink(phone) { | ||
ContentView(title: phone) | ||
} | ||
} | ||
.listStyle(.insetGrouped) | ||
} | ||
} | ||
|
||
struct iPhoneTabView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
iPhoneTabView() | ||
} | ||
} |
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
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
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
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,22 @@ | ||
// | ||
// TabIdentifier.swift | ||
// | ||
// | ||
// Created by Mark DiFranco on 2023-03-12. | ||
// | ||
|
||
import Foundation | ||
|
||
// MARK: - TabIdentifier | ||
|
||
public struct TabIdentifier: Identifiable, Hashable, Equatable, ExpressibleByStringLiteral { | ||
public let id: String | ||
|
||
public init(_ id: String) { | ||
self.id = id | ||
} | ||
|
||
public init(stringLiteral value: String) { | ||
id = value | ||
} | ||
} |
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
Oops, something went wrong.