Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 73 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,56 +10,105 @@ concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

env:
SWIFTLINT_VERSION: 0.65.1

jobs:
lint:
name: SwiftLint
runs-on: macos-15
runs-on: macos-26
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install SwiftLint
- name: Install SwiftLint ${{ env.SWIFTLINT_VERSION }}
run: |
brew update
brew install swiftlint
curl -sSL -o swiftlint.zip "https://github.com/realm/SwiftLint/releases/download/${SWIFTLINT_VERSION}/portable_swiftlint.zip"
unzip -q swiftlint.zip -d "$RUNNER_TEMP/swiftlint"
echo "$RUNNER_TEMP/swiftlint" >> "$GITHUB_PATH"

- name: Run SwiftLint
run: swiftlint --strict --quiet

test-macos:
name: macOS Tests (Swift ${{ matrix.swift }})
runs-on: macos-15
strategy:
fail-fast: false
matrix:
swift: ['6.0']
name: macOS Tests
runs-on: macos-26
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Run Tests
run: swift test --enable-code-coverage -v
run: swift test --enable-code-coverage

test-ios:
name: iOS Simulator Tests
runs-on: macos-15
runs-on: macos-26
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Run iOS Simulator Tests
run: |
SIM_ID=$(xcrun simctl list devices available | grep -E "iPhone" | head -1 | grep -o -E "[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}")
echo "Selected simulator ID: $SIM_ID"
if [ -n "$SIM_ID" ]; then
xcodebuild test \
-scheme BaseNavigationStack \
-destination "id=$SIM_ID" \
CODE_SIGNING_ALLOWED=NO
else
echo "No iPhone simulator found, testing with generic platform"
xcodebuild build \
-scheme BaseNavigationStack \
-destination 'generic/platform=iOS' \
CODE_SIGNING_ALLOWED=NO
if [ -z "$SIM_ID" ]; then
echo "::error::No iPhone simulator available"
exit 1
fi
echo "Selected simulator ID: $SIM_ID"
xcodebuild test \
-scheme BaseNavigationStack \
-destination "id=$SIM_ID" \
CODE_SIGNING_ALLOWED=NO

build-platforms:
name: Build (${{ matrix.platform }})
runs-on: macos-26
strategy:
fail-fast: false
matrix:
platform: [tvOS, watchOS, visionOS]
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Build Package
run: |
xcodebuild build \
-scheme BaseNavigationStack \
-destination "generic/platform=${{ matrix.platform }}" \
CODE_SIGNING_ALLOWED=NO

build-example:
name: Build Example App
runs-on: macos-26
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Build Example
run: |
xcodebuild build \
-project NavigationStackExample/NavigationStackExample.xcodeproj \
-scheme NavigationStackExample \
-destination 'generic/platform=iOS Simulator' \
CODE_SIGNING_ALLOWED=NO
13 changes: 11 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,28 @@ name: Release
on:
push:
tags:
- 'v*.*.*'
- 'v[0-9]+.[0-9]+.[0-9]+*'
- '[0-9]+.[0-9]+.[0-9]+*'

permissions:
contents: write

jobs:
release:
name: GitHub Release
runs-on: macos-15
runs-on: macos-26
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Run Tests
run: swift test

- name: Build Package for Release
run: swift build -c release

Expand Down
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Changelog

All notable changes to this project are documented here. Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow [SemVer](https://semver.org).

## [2.0.0] - Unreleased

### Added
- `NavigationRouter<Route, Sheet, Cover>`: one `@MainActor @Observable` router for stack, sheet, and cover.
- `BaseNavigationContainer` and `View.navigationRouter(...)`.
- `maxDepth` stack cap (default 30) and duplicate-top push guard.
- `push`, `replacePath`, `present(sheet:)`, `present(cover:)` return `Bool` (`@discardableResult`) and log rejections via `os.Logger`.
- `send(_:)` returns its `Task` so callers can await the main-actor mutation.
- tvOS 17, watchOS 10, and visionOS 1 declared in `Package.swift`.

### Changed
- **Breaking:** `swift-tools-version` 6.0 (Xcode 16+), Swift 6 language mode; minimums iOS 17 / macOS 14.
- Because `push`/`present`/`replacePath` now return `Bool`, generic single-expression closures such as `MainActor.run { router.push(x) }` infer `Bool` and warn about an unused result. Call `await router.push(x)` directly, or write `_ = router.push(x)`.
- macOS presents covers as sheets instead of ignoring them.
- A sheet and a cover can no longer be presented at the same time through the router API.
- `maxDepth` is clamped to `>= 1` on every assignment (assigning a negative value previously crashed `replacePath`); `initialPath` is truncated to `maxDepth`.

### Removed
- **Breaking:** public `Collection.subscript(safe:)` and `Array.removeLastSafe()`.
- Redundant `@unchecked Sendable` on `@MainActor` classes.

### Fixed
- v1 `BaseNavigationStack.dismiss()` pops a single-screen stack; `replaceNavigationStack(path:)` clears active modals.

## [1.0.3] - 2023-12-24

Last 1.x release (`BaseNavigationStack<ScreenView>` + `BaseViewProtocol`).
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
3E7A81C72B2B06C70003D5A3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3E7A81C62B2B06C70003D5A3 /* Assets.xcassets */; };
3E7A81CA2B2B06C70003D5A3 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3E7A81C92B2B06C70003D5A3 /* Preview Assets.xcassets */; };
3E7A81D52B2B07C50003D5A3 /* BaseNavigationStack in Frameworks */ = {isa = PBXBuildFile; productRef = 3E7A81D42B2B07C50003D5A3 /* BaseNavigationStack */; };
3E7A81D72B2B0F1A0003D5A3 /* ViewNavigationTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E7A81D62B2B0F1A0003D5A3 /* ViewNavigationTarget.swift */; };
3E7A81DC2B2B0FA90003D5A3 /* View+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E7A81DB2B2B0FA90003D5A3 /* View+Extension.swift */; };
3E7A81E02B2B0FE50003D5A3 /* ListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E7A81DF2B2B0FE50003D5A3 /* ListView.swift */; };
3E7A81E22B2B10040003D5A3 /* BaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E7A81E12B2B10040003D5A3 /* BaseView.swift */; };
3E7A81E42B2C50A80003D5A3 /* PolicyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E7A81E32B2C50A80003D5A3 /* PolicyView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -25,11 +20,6 @@
3E7A81C42B2B06C60003D5A3 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
3E7A81C62B2B06C70003D5A3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
3E7A81C92B2B06C70003D5A3 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
3E7A81D62B2B0F1A0003D5A3 /* ViewNavigationTarget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewNavigationTarget.swift; sourceTree = "<group>"; };
3E7A81DB2B2B0FA90003D5A3 /* View+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+Extension.swift"; sourceTree = "<group>"; };
3E7A81DF2B2B0FE50003D5A3 /* ListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListView.swift; sourceTree = "<group>"; };
3E7A81E12B2B10040003D5A3 /* BaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseView.swift; sourceTree = "<group>"; };
3E7A81E32B2C50A80003D5A3 /* PolicyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PolicyView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -63,9 +53,6 @@
3E7A81C12B2B06C60003D5A3 /* NavigationStackExample */ = {
isa = PBXGroup;
children = (
3E7A81DE2B2B0FD90003D5A3 /* View */,
3E7A81DD2B2B0FBE0003D5A3 /* BaseDefineTarget */,
3E7A81DA2B2B0F4D0003D5A3 /* Utils */,
3E7A81C22B2B06C60003D5A3 /* NavigationStackExampleApp.swift */,
3E7A81C42B2B06C60003D5A3 /* ContentView.swift */,
3E7A81C62B2B06C70003D5A3 /* Assets.xcassets */,
Expand All @@ -82,32 +69,6 @@
path = "Preview Content";
sourceTree = "<group>";
};
3E7A81DA2B2B0F4D0003D5A3 /* Utils */ = {
isa = PBXGroup;
children = (
3E7A81DB2B2B0FA90003D5A3 /* View+Extension.swift */,
);
path = Utils;
sourceTree = "<group>";
};
3E7A81DD2B2B0FBE0003D5A3 /* BaseDefineTarget */ = {
isa = PBXGroup;
children = (
3E7A81D62B2B0F1A0003D5A3 /* ViewNavigationTarget.swift */,
);
path = BaseDefineTarget;
sourceTree = "<group>";
};
3E7A81DE2B2B0FD90003D5A3 /* View */ = {
isa = PBXGroup;
children = (
3E7A81DF2B2B0FE50003D5A3 /* ListView.swift */,
3E7A81E12B2B10040003D5A3 /* BaseView.swift */,
3E7A81E32B2C50A80003D5A3 /* PolicyView.swift */,
);
path = View;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -185,12 +146,7 @@
buildActionMask = 2147483647;
files = (
3E7A81C52B2B06C60003D5A3 /* ContentView.swift in Sources */,
3E7A81D72B2B0F1A0003D5A3 /* ViewNavigationTarget.swift in Sources */,
3E7A81E02B2B0FE50003D5A3 /* ListView.swift in Sources */,
3E7A81DC2B2B0FA90003D5A3 /* View+Extension.swift in Sources */,
3E7A81E22B2B10040003D5A3 /* BaseView.swift in Sources */,
3E7A81C32B2B06C60003D5A3 /* NavigationStackExampleApp.swift in Sources */,
3E7A81E42B2C50A80003D5A3 /* PolicyView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -340,7 +296,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.baseNavigationStack.NavigationStackExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down Expand Up @@ -369,7 +325,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.baseNavigationStack.NavigationStackExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,10 @@ struct AsyncLabView: View {

Button("Simulate Background Async Push") {
isLoading = true
let router = labRouter
Task.detached {
try? await Task.sleep(nanoseconds: 1_000_000_000)
labRouter.send { r in
router.send { r in
isLoading = false
r.push(.detail(title: "Loaded from Network Actor"))
}
Expand Down
Loading
Loading