Skip to content

Commit

Permalink
[fix-209] - Refactor WorkflowItemWrapper to reduce view graph complex…
Browse files Browse the repository at this point in the history
…ity - TT
  • Loading branch information
Tyler-Keith-Thompson committed Aug 13, 2022
1 parent 38a4c50 commit 4d11119
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ platform :ios do
end
end

platform :macOS do
platform :mac do
lane :CLI_test do
scan(
code_coverage: true,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- uses: actions/checkout@v2
- name: Run CLI TESTS
run: |
bundle exec fastlane macOS CLI_test
bundle exec fastlane mac CLI_test
working-directory: ${{ env.working-directory }}

build_for_swift_package_manager:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/PR_CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- uses: actions/checkout@v2
- name: Run CLI TESTS
run: |
bundle exec fastlane macOS CLI_test
bundle exec fastlane mac CLI_test
working-directory: ${{ env.working-directory }}

build_for_swift_package_manager:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ final class UIKitInteropTests: XCTestCase, View {
}

func testPuttingAUIKitViewInsideASwiftUIWorkflowWithOtherSwiftUIViews() async throws {
throw XCTSkip("Issue with environment objects being read, functionality appears to still work")
struct FR1: View, FlowRepresentable, Inspectable {
weak var _workflowPointer: AnyFlowRepresentable?
let str: String
Expand Down
17 changes: 8 additions & 9 deletions Sources/SwiftCurrent_SwiftUI/Views/WorkflowItemWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,18 @@ public struct WorkflowItemWrapper<WI: _WorkflowItemProtocol, Wrapped: _WorkflowI

public var body: some View {
ViewBuilder {
if content.canDisplay(model.body) || content.didDisplay(model.body) {
if launchStyle == .navigationLink {
content.navLink(to: nextView, isActive: $isActive)
} else if case .modal(let modalStyle) = wrapped?.workflowLaunchStyle {
content.modal(isPresented: $isActive, style: modalStyle, destination: nextView)
} else {
content
}
let canDisplay = content.canDisplay(model.body)
let shouldDisplayContent = canDisplay || content.didDisplay(model.body)
if launchStyle == .navigationLink, shouldDisplayContent {
content.navLink(to: nextView, isActive: $isActive)
} else if case .modal(let modalStyle) = wrapped?.workflowLaunchStyle, shouldDisplayContent {
content.modal(isPresented: $isActive, style: modalStyle, destination: nextView)
} else if canDisplay {
content
} else {
nextView
}
}
.environmentObject(model)
.onReceive(model.$body, perform: activateIfNeeded)
.onReceive(model.$body, perform: proceedInWorkflow)
.onReceive(model.onBackUpPublisher, perform: backUpInWorkflow)
Expand Down

0 comments on commit 4d11119

Please sign in to comment.