Skip to content

Commit 03a9622

Browse files
Added scalable package navigation code
1 parent 13e14c6 commit 03a9622

22 files changed

Lines changed: 685 additions & 0 deletions

File tree

.DS_Store

0 Bytes
Binary file not shown.
6 KB
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
/.build
3+
/Packages
4+
xcuserdata/
5+
DerivedData/
6+
.swiftpm/configuration/registries.json
7+
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
8+
.netrc
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// swift-tools-version: 6.2
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "CartPackage",
8+
products: [
9+
// Products define the executables and libraries a package produces, making them visible to other packages.
10+
.library(
11+
name: "CartPackage",
12+
targets: ["CartPackage"]
13+
),
14+
],
15+
dependencies: [
16+
.package(name: "Router", path: "../Router") // Local path
17+
],
18+
targets: [
19+
// Targets are the basic building blocks of a package, defining a module or a test suite.
20+
// Targets can depend on other targets in this package and products from dependencies.
21+
.target(
22+
name: "CartPackage",
23+
dependencies: ["Router"] // Explicit dependency
24+
),
25+
26+
]
27+
)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import SwiftUI
2+
import Router
3+
4+
@available(iOS 13.0, *)
5+
public struct CartView: View {
6+
@EnvironmentObject var router: AppRouter
7+
8+
public init() {}
9+
10+
public var body: some View {
11+
VStack(spacing: 20) {
12+
Text("🛒 Cart")
13+
.font(.largeTitle)
14+
ForEach(router.cartItems, id: \.self) { item in
15+
Text(item)
16+
}
17+
Button("Place Order") {
18+
router.path.append(.summary)
19+
}
20+
}
21+
}
22+
}

ScalablePackageNavigation/CustomFoundation/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
/.build
3+
/Packages
4+
xcuserdata/
5+
DerivedData/
6+
.swiftpm/configuration/registries.json
7+
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
8+
.netrc
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// swift-tools-version: 6.2
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "OrderSummaryPackage",
8+
products: [
9+
// Products define the executables and libraries a package produces, making them visible to other packages.
10+
.library(
11+
name: "OrderSummaryPackage",
12+
targets: ["OrderSummaryPackage"]
13+
),
14+
],
15+
dependencies: [
16+
.package(name: "Router", path: "../Router") // Local path
17+
],
18+
targets: [
19+
// Targets are the basic building blocks of a package, defining a module or a test suite.
20+
// Targets can depend on other targets in this package and products from dependencies.
21+
.target(
22+
name: "OrderSummaryPackage",
23+
dependencies: ["Router"]
24+
),
25+
26+
]
27+
)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import SwiftUI
2+
import Router
3+
4+
@available(iOS 13.0, *)
5+
public struct OrderSummaryView: View {
6+
@EnvironmentObject var router: AppRouter
7+
8+
public init() {}
9+
10+
public var body: some View {
11+
VStack(spacing: 20) {
12+
Text("📦 Order Summary")
13+
.font(.largeTitle)
14+
ForEach(router.cartItems, id: \.self) { item in
15+
Text("Ordered: \(item)")
16+
}
17+
Button("Go to Home") {
18+
router.path = []
19+
}
20+
}
21+
}
22+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
/.build
3+
/Packages
4+
xcuserdata/
5+
DerivedData/
6+
.swiftpm/configuration/registries.json
7+
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
8+
.netrc

0 commit comments

Comments
 (0)