Skip to content

Commit 4e89284

Browse files
authored
Perception 2.0 (#296)
* Perception 2.0 * fix * wip * fix * wip * wip * wip * wip * wip * wip * Revert "wip" This reverts commit f7a15d1. * wip * wip
1 parent 59841f8 commit 4e89284

File tree

8 files changed

+85
-89
lines changed

8 files changed

+85
-89
lines changed

.github/workflows/ci.yml

Lines changed: 34 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -36,60 +36,41 @@ jobs:
3636
- name: Run tests
3737
run: make test-${{ matrix.variation }}
3838

39-
library-15-4-compatibility:
40-
runs-on: macos-14
41-
strategy:
42-
matrix:
43-
xcode:
44-
- '15.4'
45-
ios_version:
46-
- '17.5'
47-
variation:
48-
- ios
49-
steps:
50-
- uses: actions/checkout@v4
51-
- name: Select Xcode ${{ matrix.xcode }}
52-
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
53-
- name: Skip macro validation
54-
run: defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES
55-
- name: Run tests
56-
run: make IOS_VERSION=${{matrix.ios_version}} test-${{ matrix.variation }}
57-
58-
library-evolution:
59-
name: Library Evolution
60-
runs-on: macos-15
61-
strategy:
62-
matrix:
63-
xcode:
64-
- '16.2'
65-
steps:
66-
- uses: actions/checkout@v4
67-
- name: Select Xcode ${{ matrix.xcode }}
68-
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
69-
- name: Skip macro validation
70-
run: defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES
71-
- name: Build for Library Evolution
72-
run: make build-for-library-evolution
73-
74-
wasm:
75-
name: Wasm
76-
runs-on: ubuntu-latest
77-
steps:
78-
- uses: actions/checkout@v4
79-
- uses: bytecodealliance/actions/wasmtime/setup@v1
80-
- name: Install Swift and Swift SDK for WebAssembly
81-
run: |
82-
PREFIX=/opt/swift
83-
set -ex
84-
curl -f -o /tmp/swift.tar.gz "https://download.swift.org/swift-6.0.3-release/ubuntu2204/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE-ubuntu22.04.tar.gz"
85-
sudo mkdir -p $PREFIX; sudo tar -xzf /tmp/swift.tar.gz -C $PREFIX --strip-component 1
86-
$PREFIX/usr/bin/swift sdk install https://github.com/swiftwasm/swift/releases/download/swift-wasm-6.0.3-RELEASE/swift-wasm-6.0.3-RELEASE-wasm32-unknown-wasi.artifactbundle.zip --checksum 31d3585b06dd92de390bacc18527801480163188cd7473f492956b5e213a8618
87-
echo "$PREFIX/usr/bin" >> $GITHUB_PATH
39+
# library-evolution:
40+
# name: Library Evolution
41+
# runs-on: macos-15
42+
# strategy:
43+
# matrix:
44+
# xcode:
45+
# - '16.2'
46+
# steps:
47+
# - uses: actions/checkout@v4
48+
# - name: Select Xcode ${{ matrix.xcode }}
49+
# run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
50+
# - name: Skip macro validation
51+
# run: defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES
52+
# - name: Build for Library Evolution
53+
# run: make build-for-library-evolution
8854

89-
- name: Build tests
90-
run: swift build --swift-sdk wasm32-unknown-wasi --build-tests -Xlinker -z -Xlinker stack-size=$((1024 * 1024))
91-
- name: Run tests
92-
run: wasmtime --dir . .build/debug/swift-navigationPackageTests.wasm
55+
# wasm:
56+
# name: Wasm
57+
# runs-on: ubuntu-latest
58+
# steps:
59+
# - uses: actions/checkout@v4
60+
# - uses: bytecodealliance/actions/wasmtime/setup@v1
61+
# - name: Install Swift and Swift SDK for WebAssembly
62+
# run: |
63+
# PREFIX=/opt/swift
64+
# set -ex
65+
# curl -f -o /tmp/swift.tar.gz "https://download.swift.org/swift-6.0.3-release/ubuntu2204/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE-ubuntu22.04.tar.gz"
66+
# sudo mkdir -p $PREFIX; sudo tar -xzf /tmp/swift.tar.gz -C $PREFIX --strip-component 1
67+
# $PREFIX/usr/bin/swift sdk install https://github.com/swiftwasm/swift/releases/download/swift-wasm-6.0.3-RELEASE/swift-wasm-6.0.3-RELEASE-wasm32-unknown-wasi.artifactbundle.zip --checksum 31d3585b06dd92de390bacc18527801480163188cd7473f492956b5e213a8618
68+
# echo "$PREFIX/usr/bin" >> $GITHUB_PATH
69+
#
70+
# - name: Build tests
71+
# run: swift build --swift-sdk wasm32-unknown-wasi --build-tests -Xlinker -z -Xlinker stack-size=$((1024 * 1024))
72+
# - name: Run tests
73+
# run: wasmtime --dir . .build/debug/swift-navigationPackageTests.wasm
9374

9475
# windows:
9576
# name: Windows

Examples/CaseStudiesTests/NavigationPathTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,10 +515,10 @@ final class NavigationPathTests: XCTestCase {
515515

516516
@MainActor
517517
private protocol _ValueViewController: UIViewController {
518-
associatedtype Value
518+
associatedtype Value: Hashable
519519
var value: Value { get }
520520
}
521-
private final class ValueViewController<Value>: UIViewController, _ValueViewController {
521+
private final class ValueViewController<Value: Hashable>: UIViewController, _ValueViewController {
522522
let value: Value
523523
init(value: Value) {
524524
self.value = value

Examples/Examples.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.resolved

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ let package = Package(
3434
.package(url: "https://github.com/pointfreeco/swift-case-paths", from: "1.5.6"),
3535
.package(url: "https://github.com/pointfreeco/swift-concurrency-extras", from: "1.2.0"),
3636
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.3.2"),
37-
.package(url: "https://github.com/pointfreeco/swift-perception", from: "1.3.4"),
37+
.package(url: "https://github.com/pointfreeco/swift-perception", "1.3.4"..<"3.0.0"),
3838
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.4.1"),
3939
],
4040
targets: [
@@ -57,7 +57,7 @@ let package = Package(
5757
.target(
5858
name: "SwiftUINavigation",
5959
dependencies: [
60-
"SwiftNavigation",
60+
"UIKitNavigation",
6161
.product(name: "CasePaths", package: "swift-case-paths"),
6262
.product(name: "IssueReporting", package: "xctest-dynamic-overlay"),
6363
]

[email protected]

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ let package = Package(
3434
.package(url: "https://github.com/pointfreeco/swift-case-paths", from: "1.5.6"),
3535
.package(url: "https://github.com/pointfreeco/swift-concurrency-extras", from: "1.2.0"),
3636
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.3.2"),
37-
.package(url: "https://github.com/pointfreeco/swift-perception", from: "1.3.4"),
37+
.package(url: "https://github.com/pointfreeco/swift-perception", "1.3.4"..<"3.0.0"),
3838
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.4.1"),
3939
],
4040
targets: [
@@ -82,7 +82,7 @@ let package = Package(
8282
.target(
8383
name: "AppKitNavigation",
8484
dependencies: [
85-
"SwiftNavigation",
85+
"SwiftNavigation"
8686
]
8787
),
8888
.testTarget(

Sources/SwiftNavigation/UIBinding.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,13 @@ private final class _UIBindingWeakRoot<Root: AnyObject, Value>: _UIBinding, @unc
556556
self.keyPath = keyPath
557557
self.objectIdentifier = ObjectIdentifier(root)
558558
self.root = root
559-
self.value = root[keyPath: keyPath]
559+
#if DEBUG
560+
self.value = _PerceptionLocals.$skipPerceptionChecking.withValue(true) {
561+
root[keyPath: keyPath]
562+
}
563+
#else
564+
self.value = root[keyPath: keyPath]
565+
#endif
560566
self.fileID = fileID
561567
self.filePath = filePath
562568
self.line = line

Sources/UIKitNavigation/Navigation/NavigationStackController.swift

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,21 @@
393393
@unknown default: return nil
394394
}
395395
}
396-
if stackController.path.contains(where: {
397-
guard case .lazy = $0, $0.elementType == D.self else { return false }
398-
return true
399-
}) {
400-
stackController.path = stackController.path
396+
func resolvePath() {
397+
if stackController.path.contains(where: {
398+
guard case .lazy = $0, $0.elementType == D.self else { return false }
399+
return true
400+
}) {
401+
stackController.path = stackController.path
402+
}
401403
}
404+
#if DEBUG
405+
_PerceptionLocals.$skipPerceptionChecking.withValue(true) {
406+
resolvePath()
407+
}
408+
#else
409+
resolvePath()
410+
#endif
402411
}
403412

404413
fileprivate var navigationID: UINavigationPath.Element? {

0 commit comments

Comments
 (0)