Skip to content

ScrollViewWithOnScrollChanged: move onto onScrollGeometryChange or deprecate it #25

Open

Description

@romchornyi

Summary

ScrollViewWithOnScrollChanged (Components/Geometry/ScrollViewWithOnScrollChanged.swift) reports the scroll offset with a hand-rolled probe. The probe is a zero-size LocationReader placed at the top of the content, inside a named coordinate space. It exists because onScrollGeometryChange(for:of:action:) was not available. That API is iOS 18, and after #15 it is available at the package floor.

The system API reads contentOffset directly. The probe has two weaknesses the system API doesn't:

  • it depends on the probe staying the first child of the content;
  • it reports through onChange on every layout pass.

Why it was not done in #15

ScrollViewWithOnScrollChanged is public API. Removing or reworking it is a breaking change, and #15 deliberately left the public surface untouched.

Consumer

dashwallet-ios develop has one call site: DashWallet/Sources/UI/Menu/Settings/LocalCurrency/LocalCurrencyView.swift:146. That code uses onScrollChanged(offset) for its header.

Options

  1. Keep the type and its signature, and reimplement it on onScrollGeometryChange. This is not a breaking change. The sign and origin of the offset must stay the same as today's LocationReader value.
  2. Deprecate it (@available(*, deprecated, message: "Use onScrollGeometryChange")), move LocalCurrencyView to the system API, and remove the type in a later release.

Whichever option is chosen, update docs/utilities.md, docs/README.md and the README table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions