Skip to content

Fix the onChange(of:perform:) deprecation warnings #41

@serge-ivamov

Description

@serge-ivamov

Split.swift:

*** Split.swift-old	2024-10-09 14:50:59.622048883 +0400
--- Split.swift-new	2024-10-09 16:00:36.372341071 +0400
***************
*** 99,105 ****
              }
              .clipped()  // Can cause problems in some List styles if not clipped
              .environmentObject(layout)
!             .onChange(of: fraction.value) { new in constrainedFraction = new }
          }
      }
  
--- 99,105 ----
              }
              .clipped()  // Can cause problems in some List styles if not clipped
              .environmentObject(layout)
!             .onChange(of: fraction.value) { constrainedFraction = fraction.value }
          }
      }

Splitter.swift:

*** Splitter.swift-old	2024-10-09 14:50:59.624959091 +0400
--- Splitter.swift-new	2024-10-09 16:00:42.523829954 +0400
***************
*** 68,75 ****
          // hidden when the side is hidden (styling.hideSplitter is true), then set the
          // splitter color to clear. When the splitter is actually hidden, it doesn't even
          // exist, but when previewing it does, so we have to make it invisible this way.
!         .onChange(of: styling.previewHide) { hide in
!             if hide {
                  dividerColor = styling.hideSplitter ? .clear : privateColor ?? color
              } else {
                  dividerColor = privateColor ?? color
--- 68,75 ----
          // hidden when the side is hidden (styling.hideSplitter is true), then set the
          // splitter color to clear. When the splitter is actually hidden, it doesn't even
          // exist, but when previewing it does, so we have to make it invisible this way.
!         .onChange(of: styling.previewHide) {
!             if styling.previewHide {
                  dividerColor = styling.hideSplitter ? .clear : privateColor ?? color
              } else {
                  dividerColor = privateColor ?? color

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions