workflow-swift icon indicating copy to clipboard operation
workflow-swift copied to clipboard

[WIP] WorkflowSwiftUI without ObservedObject

Open square-tomb opened this issue 2 years ago • 1 comments

Experiment:

  • No SwiftUIScreen protocol. SwiftUI View conforms directly to Screen
  • No ObservableValue. SwiftUI View has multiple, plain, value-typed properties instead of a single @ObservedObject model
  • Each Workflow re-render sets UIHostingController.rootView

This approach previously resulted in animation issues documented in Binding SwiftUI Views to Workflow Renderings and 2020's WorkflowView, but I saw none in the SwiftUITestbed app under Xcode 14 and iOS 16.

This approach might lead to more view body evaluations, but after my performance noodling last month, I think those evaluations are cheap as long as they don't trigger additional work in the Core Animation commit phase.

square-tomb avatar Oct 30 '23 16:10 square-tomb

This approach previously resulted in animation issues documented in Binding SwiftUI Views to Workflow Renderings - Google Docs and 2020's WorkflowView, but I saw none in the SwiftUITestbed app under Xcode 14 and iOS 16.

Update: @mjohnson12 tested under iOS 15 and found the same broken animation for Toggle that we reported in that design doc.

https://github.com/square/workflow-swift/assets/106167956/0efbee20-7191-4e61-84ef-4741436f4ed0

square-tomb avatar Oct 31 '23 19:10 square-tomb