Skip to content

Commit 2cebe59

Browse files
Merge pull request #210 from wwt/fix-209
Fixes an issue where skipping views with a NavigationStack or Modal presentation style didn't work correctly with SwiftUI
2 parents fc8bc23 + 4d11119 commit 2cebe59

17 files changed

Lines changed: 85 additions & 48 deletions

.github/SwiftCurrentLint/SwiftCurrentLint.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@
347347
isa = XCBuildConfiguration;
348348
buildSettings = {
349349
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
350-
CODE_SIGN_IDENTITY = "Apple Development";
350+
CODE_SIGN_IDENTITY = "-";
351351
CODE_SIGN_STYLE = Manual;
352352
CURRENT_PROJECT_VERSION = 1;
353353
DEVELOPMENT_TEAM = KRX3M99K22;
@@ -367,7 +367,7 @@
367367
isa = XCBuildConfiguration;
368368
buildSettings = {
369369
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
370-
CODE_SIGN_IDENTITY = "Apple Development";
370+
CODE_SIGN_IDENTITY = "-";
371371
CODE_SIGN_STYLE = Manual;
372372
CURRENT_PROJECT_VERSION = 1;
373373
DEVELOPMENT_TEAM = KRX3M99K22;

.github/fastlane/Fastfile

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,6 @@ platform :ios do
3535
end
3636
end
3737

38-
lane :CLI_test do
39-
Dir.chdir("..") do
40-
setup_ci()
41-
match(
42-
app_identifier: ["WWT.SwiftCurrent-IRGeneratorTests"],
43-
readonly: is_ci,
44-
git_url: "git@github.com:wwt/swiftcurrent-ios-certs-and-profiles.git"
45-
)
46-
xcodebuild(
47-
test: true,
48-
scheme: 'SwiftCurrent_CLI',
49-
workspace: 'SwiftCurrent.xcworkspace',
50-
destination: [ 'platform=macOS' ]
51-
)
52-
end
53-
end
54-
5538
lane :build_swiftpm do
5639
# Confirm Core can build against Swift without any Apple SDK requirements
5740
sh('rm -rf ../../SwiftCurrent.xcworkspace/')
@@ -144,3 +127,16 @@ platform :ios do
144127
echo(message: "##[set-output name=version;]#{version}")
145128
end
146129
end
130+
131+
platform :mac do
132+
lane :CLI_test do
133+
scan(
134+
code_coverage: true,
135+
scheme: 'SwiftCurrent_CLI',
136+
workspace: '../SwiftCurrent.xcworkspace',
137+
derived_data_path: "~/Library/Developer/Xcode/DerivedData",
138+
result_bundle: true,
139+
destination: "platform=macOS"
140+
)
141+
end
142+
end

.github/fastlane/README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,6 @@ For _fastlane_ installation instructions, see [Installing _fastlane_](https://do
3131

3232

3333

34-
### ios CLI_test
35-
36-
```sh
37-
[bundle exec] fastlane ios CLI_test
38-
```
39-
40-
41-
4234
### ios build_swiftpm
4335

4436
```sh
@@ -95,6 +87,19 @@ Release a new version with a minor bump_type
9587

9688
Release a new version with a major bump_type
9789

90+
----
91+
92+
93+
## macOS
94+
95+
### macOS CLI_test
96+
97+
```sh
98+
[bundle exec] fastlane macOS CLI_test
99+
```
100+
101+
102+
98103
----
99104

100105
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.

.github/workflows/CI.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,12 @@ jobs:
4444
env:
4545
working-directory: .github
4646
DEVELOPER_DIR: /Applications/Xcode_13.0.app/Contents/Developer
47-
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
48-
MATCH_DEPLOY_KEY: ${{ secrets.MATCH_DEPLOY_KEY }}
4947
GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no"
50-
MATCH_READONLY: true
5148
steps:
5249
- uses: actions/checkout@v2
5350
- name: Run CLI TESTS
5451
run: |
55-
eval "$(ssh-agent -s)"
56-
ssh-add - <<< "${MATCH_DEPLOY_KEY}"
57-
bundle exec fastlane CLI_test
52+
bundle exec fastlane mac CLI_test
5853
working-directory: ${{ env.working-directory }}
5954

6055
build_for_swift_package_manager:

.github/workflows/PR_CI.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,12 @@ jobs:
4141
env:
4242
working-directory: .github
4343
DEVELOPER_DIR: /Applications/Xcode_13.0.app/Contents/Developer
44-
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
45-
MATCH_DEPLOY_KEY: ${{ secrets.MATCH_DEPLOY_KEY }}
4644
GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no"
47-
MATCH_READONLY: true
4845
steps:
4946
- uses: actions/checkout@v2
5047
- name: Run CLI TESTS
5148
run: |
52-
eval "$(ssh-agent -s)"
53-
ssh-add - <<< "${MATCH_DEPLOY_KEY}"
54-
bundle exec fastlane CLI_test
49+
bundle exec fastlane mac CLI_test
5550
working-directory: ${{ env.working-directory }}
5651

5752
build_for_swift_package_manager:

Sources/SwiftCurrent_SwiftUI/Protocols/_WorkflowItemProtocol.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public protocol _WorkflowItemProtocol: View where FlowRepresentableType: FlowRep
1919
func canDisplay(_ element: AnyWorkflow.Element?) -> Bool
2020
mutating func setElementRef(_ element: AnyWorkflow.Element?)
2121
func modify(workflow: AnyWorkflow)
22+
func didDisplay(_ element: AnyWorkflow.Element?) -> Bool
2223
}
2324

2425
@available(iOS 14.0, macOS 11, tvOS 14.0, watchOS 7.0, *)
@@ -42,4 +43,6 @@ extension Never: _WorkflowItemProtocol {
4243
public func canDisplay(_ element: AnyWorkflow.Element?) -> Bool { false }
4344
/// :nodoc: Protocol requirement.
4445
public func modify(workflow: AnyWorkflow) { }
46+
/// :nodoc: Protocol requirement.
47+
public func didDisplay(_ element: AnyWorkflow.Element?) -> Bool { false }
4548
}

Sources/SwiftCurrent_SwiftUI/ResultBuilders/WorkflowBuilder.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
// Created by Tyler Thompson on 2/21/22.
66
// Copyright © 2022 WWT and Tyler Thompson. All rights reserved.
77
// swiftlint:disable line_length
8-
// swiftlint:disable operator_usage_whitespace
9-
// swiftlint BUG: https://github.com/realm/SwiftLint/issues/3668
108

119
import Foundation
1210

Sources/SwiftCurrent_SwiftUI/TypeErased/AnyWorkflowItem.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ extension AnyWorkflowItem {
4545
public func modify(workflow: AnyWorkflow) {
4646
storage.modify(workflow: workflow)
4747
}
48+
49+
/// :nodoc: Protocol requirement.
50+
public func didDisplay(_ element: AnyWorkflow.Element?) -> Bool {
51+
storage.didDisplay(element)
52+
}
4853
}
4954

5055
@available(iOS 14.0, macOS 11, tvOS 14.0, watchOS 7.0, *)
@@ -59,6 +64,11 @@ fileprivate class AnyWorkflowItemStorageBase {
5964
fatalError("AnyWorkflowItemStorageBase called directly, only available internally so something has gone VERY wrong.")
6065
}
6166

67+
// swiftlint:disable:next unavailable_function
68+
func didDisplay(_ element: AnyWorkflow.Element?) -> Bool {
69+
fatalError("AnyWorkflowItemStorageBase called directly, only available internally so something has gone VERY wrong.")
70+
}
71+
6272
var workflowLaunchStyle: LaunchStyle.SwiftUI.PresentationType {
6373
fatalError("AnyWorkflowItemStorageBase called directly, only available internally so something has gone VERY wrong.")
6474
}
@@ -79,6 +89,10 @@ fileprivate final class AnyWorkflowItemStorage<Wrapped: _WorkflowItemProtocol>:
7989
holder.modify(workflow: workflow)
8090
}
8191

92+
override func didDisplay(_ element: AnyWorkflow.Element?) -> Bool {
93+
holder.didDisplay(element)
94+
}
95+
8296
override var workflowLaunchStyle: LaunchStyle.SwiftUI.PresentationType {
8397
holder.workflowLaunchStyle
8498
}

Sources/SwiftCurrent_SwiftUI/Views/EitherWorkflowItem.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ public struct EitherWorkflowItem<W0: _WorkflowItemProtocol, W1: _WorkflowItemPro
3434
}
3535
}
3636

37+
func didDisplay(_ element: AnyWorkflow.Element?) -> Bool {
38+
switch self {
39+
case .first(let first): return first.didDisplay(element)
40+
case .second(let second): return second.didDisplay(element)
41+
}
42+
}
43+
3744
case first(First)
3845
case second(Second)
3946

@@ -59,6 +66,11 @@ public struct EitherWorkflowItem<W0: _WorkflowItemProtocol, W1: _WorkflowItemPro
5966
public func canDisplay(_ element: AnyWorkflow.Element?) -> Bool {
6067
content.canDisplay(element)
6168
}
69+
70+
/// :nodoc: Protocol requirement.
71+
public func didDisplay(_ element: AnyWorkflow.Element?) -> Bool {
72+
content.didDisplay(element)
73+
}
6274
}
6375

6476
@available(iOS 14.0, macOS 11, tvOS 14.0, watchOS 7.0, *)

Sources/SwiftCurrent_SwiftUI/Views/OptionalWorkflowItem.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ public struct OptionalWorkflowItem<WI: _WorkflowItemProtocol>: View, _WorkflowIt
3030
public func canDisplay(_ element: AnyWorkflow.Element?) -> Bool {
3131
content?.canDisplay(element) ?? false
3232
}
33+
34+
/// :nodoc: Protocol requirement.
35+
public func didDisplay(_ element: AnyWorkflow.Element?) -> Bool {
36+
content?.didDisplay(element) ?? false
37+
}
3338
}
3439

3540
@available(iOS 14.0, macOS 11, tvOS 14.0, watchOS 7.0, *)

0 commit comments

Comments
 (0)