wwt / SwiftCurrent

A library for managing complex workflows in Swift
https://wwt.github.io/SwiftCurrent/
Apache License 2.0
307 stars 19 forks source link

Redesigns SwiftUI API to enable the correct type nesting needing for NavigationLinks - See discussion #113 #111

Closed Tyler-Keith-Thompson closed 3 years ago

Tyler-Keith-Thompson commented 3 years ago

Linked Issue: #101

Checklist:

codecov-commenter commented 3 years ago

Codecov Report

Merging #111 (0a1aafd) into main (6bd6c86) will decrease coverage by 0.49%. The diff coverage is 95.81%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #111      +/-   ##
==========================================
- Coverage   94.48%   93.98%   -0.50%     
==========================================
  Files          72       75       +3     
  Lines        1794     1813      +19     
==========================================
+ Hits         1695     1704       +9     
- Misses         99      109      +10     
Impacted Files Coverage Δ
...ces/SwiftCurrent/Protocols/FlowRepresentable.swift 85.00% <50.00%> (-3.89%) :arrow_down:
...rces/SwiftCurrent_SwiftUI/Views/WorkflowItem.swift 91.66% <91.66%> (ø)
ExampleApps/SwiftUIExample/Views/ContentView.swift 92.30% <100.00%> (ø)
...Example/Views/Profile/AccountInformationView.swift 100.00% <100.00%> (ø)
Sources/SwiftCurrent/TypeErased/AnyWorkflow.swift 83.33% <100.00%> (+0.64%) :arrow_up:
...ftUI/Extensions/AnyWorkflowElementExtensions.swift 100.00% <100.00%> (ø)
...iftUI/Extensions/SwiftUILaunchStyleAdditions.swift 100.00% <100.00%> (ø)
...iftCurrent_SwiftUI/Extensions/ViewExtensions.swift 100.00% <100.00%> (ø)
Sources/SwiftCurrent_SwiftUI/Models/Launcher.swift 100.00% <100.00%> (ø)
...wiftCurrent_SwiftUI/Models/WorkflowViewModel.swift 100.00% <100.00%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 13fe4f4...0a1aafd. Read the comment docs.

Tyler-Keith-Thompson commented 3 years ago

IMPORTANT:

As of the time of writing the draft PR does not actually do anything with nav links yet, to get there we had to change the public API and a decent chunk of how SwiftUI actually works. Look at #101 for more details about what we did and why.

It'd be a good idea to dive into the changes, I'll try to give a brief summary:

Tyler-Keith-Thompson commented 3 years ago

Note: Cocoapods has a global namespace, so to get things working I created LaunchStyle.SwiftUI.PresentationType. Consumers will almost always use .thing so won't have to deal with the long name. I sorta wish I could do the same with UIKit but that would be a breaking change.

Tyler-Keith-Thompson commented 3 years ago

Something to watch out for, view re-use in a nav stack. FR1 -> FR2 -> FR3 -> FR1 -> FR4.

I think it's quite doable, but may not work with the first functional iteration of this PR and it is not in the checklist, because it's sorta SwiftUI specific as an issue.

Confirmed: I spiked it out and it is doable.

Tyler-Keith-Thompson commented 3 years ago

See #113 for more details