Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/uikit-navigation-beta' into fix/…
Browse files Browse the repository at this point in the history
…uikit-navigation-issues
  • Loading branch information
stephencelis committed Jul 23, 2024
2 parents c3021c4 + 7c19e82 commit 172ccea
Show file tree
Hide file tree
Showing 25 changed files with 422 additions and 305 deletions.
20 changes: 10 additions & 10 deletions Examples/CaseStudiesTests/NavigationPathTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ final class NavigationPathTests: XCTestCase {
XCTExpectFailure {
$0.compactDescription.hasPrefix(
"""
No "navigationDestination(for: String.self) { … }" was found among the view controllers on \
the path.
failed - No "navigationDestination(for: String.self) { … }" was found among the view \
controllers on the path.
"""
)
}
Expand Down Expand Up @@ -117,8 +117,8 @@ final class NavigationPathTests: XCTestCase {
XCTExpectFailure {
$0.compactDescription.hasPrefix(
"""
No "navigationDestination(for: String.self) { … }" was found among the view controllers on \
the path.
failed - No "navigationDestination(for: String.self) { … }" was found among the view \
controllers on the path.
"""
)
}
Expand All @@ -143,8 +143,8 @@ final class NavigationPathTests: XCTestCase {
XCTExpectFailure {
$0.compactDescription.hasPrefix(
"""
No "navigationDestination(for: String.self) { … }" was found among the view controllers on \
the path.
failed - No "navigationDestination(for: String.self) { … }" was found among the view \
controllers on the path.
"""
)
}
Expand Down Expand Up @@ -289,8 +289,8 @@ final class NavigationPathTests: XCTestCase {

XCTExpectFailure {
$0.compactDescription == """
Failed to decode item in navigation path at index 1. Perhaps the "navigationDestination" \
declarations have changed since the path was encoded?
failed - Failed to decode item in navigation path at index 1. Perhaps the \
"navigationDestination" declarations have changed since the path was encoded?
"""
}
let nav = NavigationStackController(path: $path) {
Expand Down Expand Up @@ -330,8 +330,8 @@ final class NavigationPathTests: XCTestCase {

XCTExpectFailure {
$0.compactDescription == """
Failed to decode item in navigation path at index 0. Perhaps the "navigationDestination" \
declarations have changed since the path was encoded?
failed - Failed to decode item in navigation path at index 0. Perhaps the \
"navigationDestination" declarations have changed since the path was encoded?
"""
}
let nav = NavigationStackController(path: $path) {
Expand Down
19 changes: 14 additions & 5 deletions Examples/CaseStudiesTests/PresentationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ final class PresentationTests: XCTestCase {
}
await assertEventuallyEqual(nav.viewControllers.count, 2)

await Task.yield()
try await Task.sleep(for: .seconds(1))
nav.popViewController(animated: false)
await assertEventuallyEqual(nav.viewControllers.count, 1)
await assertEventuallyNil(vc.model.pushedChild)

await Task.yield()
try await Task.sleep(for: .seconds(1))
withUITransaction(\.uiKit.disablesAnimations, true) {
vc.model.pushedChild = Model()
}
Expand Down Expand Up @@ -355,11 +355,10 @@ final class PresentationTests: XCTestCase {

vc.presentedViewController?.presentedViewController?.dismiss(animated: false)
try await Task.sleep(for: .seconds(0.5))
await assertEventuallyNotNil(vc.presentedViewController timeout: 2)
await assertEventuallyNotNil(vc.presentedViewController, timeout: 2)
}

@MainActor
func testDismissMiddlePresentation() async throws {
@MainActor func testDismissMiddlePresentation() async throws {
class VC: UIViewController {
@UIBinding var isPresented = false
override func loadView() {
Expand Down Expand Up @@ -397,6 +396,10 @@ final class PresentationTests: XCTestCase {
await assertEventuallyNotNil(vc.presentedViewController as? VC)
await assertEventuallyNil(vc.presentedViewController?.presentedViewController, timeout: 2)
}

@MainActor func testDoublePresentation_ChangeRootBinding() async throws {

}
}

@Observable
Expand Down Expand Up @@ -432,6 +435,12 @@ private class BasicViewController: UIViewController {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
view.backgroundColor = .init(
red: .random(in: 0...1),
green: .random(in: 0...1),
blue: .random(in: 0...1),
alpha: 1
)
super.viewDidLoad()
present(isPresented: $model.isPresented) { [weak self] in
self?.isPresenting = false
Expand Down
16 changes: 8 additions & 8 deletions Examples/CaseStudiesTests/RuntimeWarningTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ final class RuntimeWarningTests: XCTestCase {
vc.traitCollection.dismiss()
} issueMatcher: {
$0.compactDescription == """
A view controller requested dismissal, but couldn't be dismissed.
failed - A view controller requested dismissal, but couldn't be dismissed.
'UITraitCollection.dismiss()' must be called from an object that was presented using a \
binding, for example 'UIViewController.present(item:)', and \
Expand All @@ -22,7 +22,7 @@ final class RuntimeWarningTests: XCTestCase {
func testNavigationDestination_WithoutNavigationController() async throws {
XCTExpectFailure {
$0.compactDescription == """
Can't present navigation item: "navigationController" is "nil".
failed - Can't present navigation item: "navigationController" is "nil".
"""
}
class VC: UIViewController {
Expand All @@ -40,7 +40,7 @@ final class RuntimeWarningTests: XCTestCase {
func testPushValue_WithoutNavigationStack() async throws {
XCTExpectFailure {
$0.compactDescription == """
Tried to push a value from outside of a navigation stack.
failed - Tried to push a value from outside of a navigation stack.
'UITraitCollection.push(value:)' must be called from an object in a \
'NavigationStackController'.
Expand All @@ -59,7 +59,7 @@ final class RuntimeWarningTests: XCTestCase {
func testPushValue_WithoutNavigationController() async throws {
XCTExpectFailure {
$0.compactDescription == """
Tried to push a value from outside of a navigation stack.
failed - Tried to push a value from outside of a navigation stack.
'UITraitCollection.push(value:)' must be called from an object in a \
'NavigationStackController'.
Expand All @@ -78,7 +78,7 @@ final class RuntimeWarningTests: XCTestCase {
func testPush_WithoutNavigationController() async throws {
XCTExpectFailure {
$0.compactDescription == """
Can't push value: "navigationController" is "nil".
failed - Can't push value: "navigationController" is "nil".
"""
}
class VC: UIViewController {
Expand All @@ -94,7 +94,7 @@ final class RuntimeWarningTests: XCTestCase {
func testPush_WithoutNavigationStack() async throws {
XCTExpectFailure {
$0.compactDescription == """
Tried to push a value to a non-"NavigationStackController".
failed - Tried to push a value to a non-"NavigationStackController".
"""
}
class VC: UIViewController {
Expand All @@ -110,7 +110,7 @@ final class RuntimeWarningTests: XCTestCase {
func testNavigationDestinationFor_WithoutNavigationController() async throws {
XCTExpectFailure {
$0.compactDescription == """
Can't register navigation destination: "navigationController" is "nil".
failed - Can't register navigation destination: "navigationController" is "nil".
"""
}
class VC: UIViewController {
Expand All @@ -128,7 +128,7 @@ final class RuntimeWarningTests: XCTestCase {
func testNavigationDestinationFor_WithoutNavigationStackController() async throws {
XCTExpectFailure {
$0.compactDescription == """
Tried to apply a "navigationDestination" to a non-"NavigationStackController".
failed - Tried to apply a "navigationDestination" to a non-"NavigationStackController".
"""
}
class VC: UIViewController {
Expand Down
74 changes: 53 additions & 21 deletions Examples/Examples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
CA473836272F0D860012CAC3 /* CaseStudiesApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA473830272F0D860012CAC3 /* CaseStudiesApp.swift */; };
CA473837272F0D860012CAC3 /* FactClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA473831272F0D860012CAC3 /* FactClient.swift */; };
CA473838272F0D860012CAC3 /* OptionalNavigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA473832272F0D860012CAC3 /* OptionalNavigation.swift */; };
CA47383B272F0DD60012CAC3 /* SwiftUINavigation in Frameworks */ = {isa = PBXBuildFile; productRef = CA47383A272F0DD60012CAC3 /* SwiftUINavigation */; };
CA48F2FA2C49645100BE2C3C /* SwiftUINavigation in Frameworks */ = {isa = PBXBuildFile; productRef = CA48F2F92C49645100BE2C3C /* SwiftUINavigation */; };
CA48F2FC2C49645100BE2C3C /* UIKitNavigation in Frameworks */ = {isa = PBXBuildFile; productRef = CA48F2FB2C49645100BE2C3C /* UIKitNavigation */; };
CA48F3022C49650100BE2C3C /* IdentifiedCollections in Frameworks */ = {isa = PBXBuildFile; productRef = CA48F3012C49650100BE2C3C /* IdentifiedCollections */; };
CA48F3052C49650F00BE2C3C /* Tagged in Frameworks */ = {isa = PBXBuildFile; productRef = CA48F3042C49650F00BE2C3C /* Tagged */; };
CA48F3082C49651700BE2C3C /* ConcurrencyExtras in Frameworks */ = {isa = PBXBuildFile; productRef = CA48F3072C49651700BE2C3C /* ConcurrencyExtras */; };
CA49D9542C20D4DF00E6C5BB /* ErasedNavigationStackController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA49D9532C20D4DF00E6C5BB /* ErasedNavigationStackController.swift */; };
CA49D9622C20EAB000E6C5BB /* PresentationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC5EB9D22C0525FA0034B757 /* PresentationTests.swift */; };
CA49D9632C20EAB000E6C5BB /* NavigationStackTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC5EB9D32C0525FA0034B757 /* NavigationStackTests.swift */; };
Expand All @@ -48,7 +52,6 @@
CADCA3662C1CE8BE00DE645F /* CaseStudy.swift in Sources */ = {isa = PBXBuildFile; fileRef = CADCA3652C1CE8BE00DE645F /* CaseStudy.swift */; };
DC6A8411291F227400B3F6C9 /* SynchronizedBindings.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC6A8410291F227400B3F6C9 /* SynchronizedBindings.swift */; };
DC86E8712C208D8D003C0EC9 /* Text+Template.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC86E8702C208D8A003C0EC9 /* Text+Template.swift */; };
DCE73E0A2947D090004EE92E /* IdentifiedCollections in Frameworks */ = {isa = PBXBuildFile; productRef = DCE73E092947D090004EE92E /* IdentifiedCollections */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -63,7 +66,6 @@

/* Begin PBXFileReference section */
CA26036C2C20973600822CA5 /* DetentsHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetentsHelper.swift; sourceTree = "<group>"; };
CA4737C3272F090F0012CAC3 /* swiftui-navigation */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "swiftui-navigation"; path = ..; sourceTree = "<group>"; };
CA4737C8272F095F0012CAC3 /* Inventory.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Inventory.app; sourceTree = BUILT_PRODUCTS_DIR; };
CA4737CE272F09600012CAC3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
CA4737F5272F09D00012CAC3 /* ItemRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemRow.swift; sourceTree = "<group>"; };
Expand All @@ -77,6 +79,7 @@
CA473831272F0D860012CAC3 /* FactClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FactClient.swift; sourceTree = "<group>"; };
CA473832272F0D860012CAC3 /* OptionalNavigation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OptionalNavigation.swift; sourceTree = "<group>"; };
CA47383C272F0F0D0012CAC3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
CA48F2F82C49644000BE2C3C /* swiftui-navigation */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = "swiftui-navigation"; path = ..; sourceTree = "<group>"; };
CA49D9532C20D4DF00E6C5BB /* ErasedNavigationStackController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErasedNavigationStackController.swift; sourceTree = "<group>"; };
CA49D9592C20EAA400E6C5BB /* CaseStudiesTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CaseStudiesTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
CA49D9682C20EB7200E6C5BB /* CaseStudies.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = CaseStudies.xctestplan; sourceTree = "<group>"; };
Expand Down Expand Up @@ -115,15 +118,18 @@
buildActionMask = 2147483647;
files = (
CA4737F4272F09780012CAC3 /* SwiftUINavigation in Frameworks */,
DCE73E0A2947D090004EE92E /* IdentifiedCollections in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
CA473801272F0D330012CAC3 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
CA47383B272F0DD60012CAC3 /* SwiftUINavigation in Frameworks */,
CA48F3082C49651700BE2C3C /* ConcurrencyExtras in Frameworks */,
CA48F3022C49650100BE2C3C /* IdentifiedCollections in Frameworks */,
CA48F2FA2C49645100BE2C3C /* SwiftUINavigation in Frameworks */,
CA48F3052C49650F00BE2C3C /* Tagged in Frameworks */,
CA48F2FC2C49645100BE2C3C /* UIKitNavigation in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -140,7 +146,7 @@
CA47378B272F08EF0012CAC3 = {
isa = PBXGroup;
children = (
CA4737C3272F090F0012CAC3 /* swiftui-navigation */,
CA48F2F82C49644000BE2C3C /* swiftui-navigation */,
CA473805272F0D330012CAC3 /* CaseStudies */,
CA49D95A2C20EAA400E6C5BB /* CaseStudiesTests */,
CA4737F2272F09780012CAC3 /* Frameworks */,
Expand Down Expand Up @@ -286,7 +292,6 @@
name = Inventory;
packageProductDependencies = (
CA4737F3272F09780012CAC3 /* SwiftUINavigation */,
DCE73E092947D090004EE92E /* IdentifiedCollections */,
);
productName = Inventory;
productReference = CA4737C8272F095F0012CAC3 /* Inventory.app */;
Expand All @@ -306,7 +311,11 @@
);
name = CaseStudies;
packageProductDependencies = (
CA47383A272F0DD60012CAC3 /* SwiftUINavigation */,
CA48F2F92C49645100BE2C3C /* SwiftUINavigation */,
CA48F2FB2C49645100BE2C3C /* UIKitNavigation */,
CA48F3012C49650100BE2C3C /* IdentifiedCollections */,
CA48F3042C49650F00BE2C3C /* Tagged */,
CA48F3072C49651700BE2C3C /* ConcurrencyExtras */,
);
productName = CaseStudies;
productReference = CA473804272F0D330012CAC3 /* CaseStudies.app */;
Expand Down Expand Up @@ -364,9 +373,10 @@
);
mainGroup = CA47378B272F08EF0012CAC3;
packageReferences = (
DCE73E032947D063004EE92E /* XCRemoteSwiftPackageReference "swift-tagged" */,
DCE73E062947D082004EE92E /* XCRemoteSwiftPackageReference "swift-identified-collections" */,
CA6453982968A06E00802931 /* XCRemoteSwiftPackageReference "swift-dependencies" */,
CA48F3002C49650100BE2C3C /* XCRemoteSwiftPackageReference "swift-identified-collections" */,
CA48F3032C49650F00BE2C3C /* XCRemoteSwiftPackageReference "swift-tagged" */,
CA48F3062C49651700BE2C3C /* XCRemoteSwiftPackageReference "swift-concurrency-extras" */,
);
productRefGroup = CA473795272F08EF0012CAC3 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -796,28 +806,36 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
CA6453982968A06E00802931 /* XCRemoteSwiftPackageReference "swift-dependencies" */ = {
CA48F3002C49650100BE2C3C /* XCRemoteSwiftPackageReference "swift-identified-collections" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "http://github.com/pointfreeco/swift-dependencies";
repositoryURL = "https://github.com/pointfreeco/swift-identified-collections.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.0.0;
minimumVersion = 1.1.0;
};
};
DCE73E032947D063004EE92E /* XCRemoteSwiftPackageReference "swift-tagged" */ = {
CA48F3032C49650F00BE2C3C /* XCRemoteSwiftPackageReference "swift-tagged" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/pointfreeco/swift-tagged.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.7.0;
minimumVersion = 0.10.0;
};
};
DCE73E062947D082004EE92E /* XCRemoteSwiftPackageReference "swift-identified-collections" */ = {
CA48F3062C49651700BE2C3C /* XCRemoteSwiftPackageReference "swift-concurrency-extras" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/pointfreeco/swift-identified-collections.git";
repositoryURL = "https://github.com/pointfreeco/swift-concurrency-extras.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.0.0;
minimumVersion = 1.1.0;
};
};
CA6453982968A06E00802931 /* XCRemoteSwiftPackageReference "swift-dependencies" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "http://github.com/pointfreeco/swift-dependencies";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.3.3;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand All @@ -827,15 +845,29 @@
isa = XCSwiftPackageProductDependency;
productName = SwiftUINavigation;
};
CA47383A272F0DD60012CAC3 /* SwiftUINavigation */ = {
CA48F2F92C49645100BE2C3C /* SwiftUINavigation */ = {
isa = XCSwiftPackageProductDependency;
productName = SwiftUINavigation;
};
DCE73E092947D090004EE92E /* IdentifiedCollections */ = {
CA48F2FB2C49645100BE2C3C /* UIKitNavigation */ = {
isa = XCSwiftPackageProductDependency;
productName = UIKitNavigation;
};
CA48F3012C49650100BE2C3C /* IdentifiedCollections */ = {
isa = XCSwiftPackageProductDependency;
package = DCE73E062947D082004EE92E /* XCRemoteSwiftPackageReference "swift-identified-collections" */;
package = CA48F3002C49650100BE2C3C /* XCRemoteSwiftPackageReference "swift-identified-collections" */;
productName = IdentifiedCollections;
};
CA48F3042C49650F00BE2C3C /* Tagged */ = {
isa = XCSwiftPackageProductDependency;
package = CA48F3032C49650F00BE2C3C /* XCRemoteSwiftPackageReference "swift-tagged" */;
productName = Tagged;
};
CA48F3072C49651700BE2C3C /* ConcurrencyExtras */ = {
isa = XCSwiftPackageProductDependency;
package = CA48F3062C49651700BE2C3C /* XCRemoteSwiftPackageReference "swift-concurrency-extras" */;
productName = ConcurrencyExtras;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = CA47378C272F08EF0012CAC3 /* Project object */;
Expand Down
Loading

0 comments on commit 172ccea

Please sign in to comment.