Skip to content

Commit

Permalink
Merge branch 'feature/node-rewrite'
Browse files Browse the repository at this point in the history
  • Loading branch information
johnpatrickmorgan committed Jan 29, 2024
2 parents 9629bd3 + 50527b8 commit 468de81
Show file tree
Hide file tree
Showing 12 changed files with 455 additions and 168 deletions.
2 changes: 1 addition & 1 deletion FlowStacks.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = 'FlowStacks'
s.version = '0.3.8'
s.version = '0.4.0'
s.summary = 'Hoist navigation state into a coordinator in SwiftUI.'

s.description = <<-DESC
Expand Down
133 changes: 132 additions & 1 deletion FlowStacksApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,23 @@
526D9F2F26AF661F00B6B882 /* VMCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 526D9F2226AF661F00B6B882 /* VMCoordinator.swift */; };
526D9F3326AF667000B6B882 /* FlowStacksApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 526D9F3226AF667000B6B882 /* FlowStacksApp.swift */; };
526D9F3426AF667000B6B882 /* FlowStacksApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 526D9F3226AF667000B6B882 /* FlowStacksApp.swift */; };
5285BBAF2B6408F500197CE7 /* FlowStacksAppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5285BBAE2B6408F500197CE7 /* FlowStacksAppUITests.swift */; };
52C5CCDE286EE92B0075ABA7 /* Deeplink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52C5CCDD286EE92B0075ABA7 /* Deeplink.swift */; };
52C5CCDF286EE92B0075ABA7 /* Deeplink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52C5CCDD286EE92B0075ABA7 /* Deeplink.swift */; };
77F136ED282E45E0008A6A02 /* ParentCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77F136EC282E45DF008A6A02 /* ParentCoordinator.swift */; };
77F136EE282E45E0008A6A02 /* ParentCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77F136EC282E45DF008A6A02 /* ParentCoordinator.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
5285BBB22B6408F500197CE7 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 5241BF2726AA1D3A002D6892 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 5241BF3226AA1D3B002D6892;
remoteInfo = "FlowStacksApp (iOS)";
};
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
5241BF3326AA1D3B002D6892 /* FlowStacksApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FlowStacksApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
5241BF3926AA1D3B002D6892 /* FlowStacksApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FlowStacksApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -38,6 +49,8 @@
526D9F1C26AF661F00B6B882 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
526D9F2226AF661F00B6B882 /* VMCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VMCoordinator.swift; sourceTree = "<group>"; };
526D9F3226AF667000B6B882 /* FlowStacksApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlowStacksApp.swift; sourceTree = "<group>"; };
5285BBAC2B6408F500197CE7 /* FlowStacksAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FlowStacksAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
5285BBAE2B6408F500197CE7 /* FlowStacksAppUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlowStacksAppUITests.swift; sourceTree = "<group>"; };
52C5CCDB286E5D780075ABA7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
52C5CCDD286EE92B0075ABA7 /* Deeplink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Deeplink.swift; sourceTree = "<group>"; };
52E2C8F02A7265A00042C495 /* FlowStacks */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlowStacks; path = .; sourceTree = "<group>"; };
Expand All @@ -63,6 +76,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
5285BBA92B6408F500197CE7 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
Expand All @@ -79,6 +99,7 @@
children = (
521678E12A2FD6AE00954579 /* Packages */,
526D9F1B26AF661F00B6B882 /* FlowStacksApp */,
5285BBAD2B6408F500197CE7 /* FlowStacksAppUITests */,
5241BF3426AA1D3B002D6892 /* Products */,
5241BF6D26AA1E8A002D6892 /* Frameworks */,
);
Expand All @@ -89,6 +110,7 @@
children = (
5241BF3326AA1D3B002D6892 /* FlowStacksApp.app */,
5241BF3926AA1D3B002D6892 /* FlowStacksApp.app */,
5285BBAC2B6408F500197CE7 /* FlowStacksAppUITests.xctest */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -124,6 +146,14 @@
path = Shared;
sourceTree = "<group>";
};
5285BBAD2B6408F500197CE7 /* FlowStacksAppUITests */ = {
isa = PBXGroup;
children = (
5285BBAE2B6408F500197CE7 /* FlowStacksAppUITests.swift */,
);
path = FlowStacksAppUITests;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -169,14 +199,32 @@
productReference = 5241BF3926AA1D3B002D6892 /* FlowStacksApp.app */;
productType = "com.apple.product-type.application";
};
5285BBAB2B6408F500197CE7 /* FlowStacksAppUITests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 5285BBB62B6408F500197CE7 /* Build configuration list for PBXNativeTarget "FlowStacksAppUITests" */;
buildPhases = (
5285BBA82B6408F500197CE7 /* Sources */,
5285BBA92B6408F500197CE7 /* Frameworks */,
5285BBAA2B6408F500197CE7 /* Resources */,
);
buildRules = (
);
dependencies = (
5285BBB32B6408F500197CE7 /* PBXTargetDependency */,
);
name = FlowStacksAppUITests;
productName = FlowStacksAppUITests;
productReference = 5285BBAC2B6408F500197CE7 /* FlowStacksAppUITests.xctest */;
productType = "com.apple.product-type.bundle.ui-testing";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
5241BF2726AA1D3A002D6892 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1300;
LastSwiftUpdateCheck = 1510;
LastUpgradeCheck = 1500;
TargetAttributes = {
5241BF3226AA1D3B002D6892 = {
Expand All @@ -185,6 +233,10 @@
5241BF3826AA1D3B002D6892 = {
CreatedOnToolsVersion = 13.0;
};
5285BBAB2B6408F500197CE7 = {
CreatedOnToolsVersion = 15.1;
TestTargetID = 5241BF3226AA1D3B002D6892;
};
};
};
buildConfigurationList = 5241BF2A26AA1D3A002D6892 /* Build configuration list for PBXProject "FlowStacksApp" */;
Expand All @@ -205,6 +257,7 @@
targets = (
5241BF3226AA1D3B002D6892 /* FlowStacksApp (iOS) */,
5241BF3826AA1D3B002D6892 /* FlowStacksApp (macOS) */,
5285BBAB2B6408F500197CE7 /* FlowStacksAppUITests */,
);
};
/* End PBXProject section */
Expand All @@ -226,6 +279,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
5285BBAA2B6408F500197CE7 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -257,8 +317,24 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
5285BBA82B6408F500197CE7 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5285BBAF2B6408F500197CE7 /* FlowStacksAppUITests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
5285BBB32B6408F500197CE7 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 5241BF3226AA1D3B002D6892 /* FlowStacksApp (iOS) */;
targetProxy = 5285BBB22B6408F500197CE7 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */

/* Begin XCBuildConfiguration section */
5241BF4026AA1D3B002D6892 /* Debug */ = {
isa = XCBuildConfiguration;
Expand Down Expand Up @@ -502,6 +578,52 @@
};
name = Release;
};
5285BBB42B6408F500197CE7 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GCC_C_LANGUAGE_STANDARD = gnu17;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = co.uk.johnpatrickmorgan.FlowStacksAppUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = "FlowStacksApp (iOS)";
};
name = Debug;
};
5285BBB52B6408F500197CE7 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GCC_C_LANGUAGE_STANDARD = gnu17;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = co.uk.johnpatrickmorgan.FlowStacksAppUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = "FlowStacksApp (iOS)";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
Expand Down Expand Up @@ -532,6 +654,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
5285BBB62B6408F500197CE7 /* Build configuration list for PBXNativeTarget "FlowStacksAppUITests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5285BBB42B6408F500197CE7 /* Debug */,
5285BBB52B6408F500197CE7 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5285BBAB2B6408F500197CE7"
BuildableName = "FlowStacksAppUITests.xctest"
BlueprintName = "FlowStacksAppUITests"
ReferencedContainer = "container:FlowStacksApp.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
5 changes: 5 additions & 0 deletions FlowStacksApp/Shared/NumberCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,23 @@ struct NumberView: View {
Button("Present Double (cover)") {
navigator.presentCover(.number(number * 2), embedInNavigationView: true)
}
.accessibilityIdentifier("Present Double (cover) from \(number)")
Button("Present Double (sheet)") {
navigator.presentSheet(.number(number * 2), embedInNavigationView: true)
}
.accessibilityIdentifier("Present Double (sheet) from \(number)")
Button("Push next") {
navigator.push(.number(number + 1))
}
.accessibilityIdentifier("Push next from \(number)")
if let goRandom = goRandom {
Button("Go random", action: goRandom)
}
if navigator.routes.count > 1 {
Button("Go back") { navigator.goBack() }
.accessibilityIdentifier("Go back from \(number)")
Button("Go back to root") { navigator.goBackToRoot() }
.accessibilityIdentifier("Go back to root from \(number)")
}
}
.padding()
Expand Down
11 changes: 8 additions & 3 deletions FlowStacksApp/Shared/VMCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ class VMCoordinatorViewModel: ObservableObject {
@Published var routes: Routes<Screen> = []

init() {
routes.presentSheet(.home(.init(pickANumberSelected: showNumberList)))
routes.presentSheet(.home(.init(pickANumberSelected: showNumberList)), embedInNavigationView: true)
}

func showNumberList() {
routes.presentSheet(.numberList(.init(numberSelected: showNumber, cancel: dismiss)))
routes.push(.numberList(.init(numberSelected: showNumber, cancel: dismiss)))
}

func showNumber(_ number: Int) {
routes.presentSheet(.numberDetail(.init(number: number, cancel: goBackToRoot)))
routes.presentSheet(.numberDetail(.init(number: number, cancel: goBackToRoot)), embedInNavigationView: true)
}

func dismiss() {
Expand Down Expand Up @@ -111,13 +111,18 @@ struct NumberDetailView: View {

@Environment(\.presentationMode) var presentationMode

@EnvironmentObject var navigator: FlowNavigator<VMCoordinatorViewModel.Screen>

var body: some View {
VStack {
Text("\(viewModel.number)")
Button("Go back to root", action: viewModel.cancel)
Button("PresentationMode Dismiss") {
presentationMode.wrappedValue.dismiss()
}
Button("Navigator Dismiss") {
navigator.goBack()
}
}
.navigationTitle("Number \(viewModel.number)")
}
Expand Down

0 comments on commit 468de81

Please sign in to comment.