Skip to content

Deprecate eraseToAnyView in favor of ViewBuilder or AnyView - #33

Open
Jeehut wants to merge 1 commit into
mainfrom
wip/deprecate-erasetoanyview
Open

Jeehut wants to merge 1 commit into
mainfrom
wip/deprecate-erasetoanyview

Conversation

@Jeehut

@Jeehut Jeehut commented Nov 21, 2026

Copy link
Copy Markdown
Member

eraseToAnyView() only wraps AnyView(self). @ViewBuilder covers most cases where it was used, and AnyView(_:) says the same thing directly. The method is now deprecated with a message naming both options; it still works. MultiSelector uses AnyView(_:) itself, and the DocC entry moved to a "Deprecated" section.

Considered: removing it in 3.0.0. Deprecating first gives callers a warning with the replacement instead of a build error.

How this was verified

  • swift test --build-system swiftbuild: 40 tests in 13 suites passed, no deprecation warning from Sources/.
  • A search in the apps that use HandySwiftUI found no call of eraseToAnyView().
  • Review: Code ✓ · Design – · QA –

Door two-way · Blast Radius breit (public API, re-exported by FlineDevKit)

eraseToAnyView() only wraps AnyView(_:), and most uses are better
written with @ViewBuilder, which keeps the view types. Mark it as
deprecated with a message that names both ways and move it to a
Deprecated section in the documentation. MultiSelector now calls
AnyView(_:) directly, so the package emits no own warning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant