Skip to content

Avoid the deprecated onChange(of:perform:) on visionOS - #21

Merged
Jeehut merged 1 commit into
mainfrom
wip/onchange-visionos
Oct 15, 2026
Merged

Jeehut merged 1 commit into
mainfrom
wip/onchange-visionos

Conversation

@Jeehut

@Jeehut Jeehut commented Oct 14, 2026

Copy link
Copy Markdown
Member

Overview

onChange(of:perform:) is deprecated from the start on visionOS (and starting with iOS 17 elsewhere), so LimitedTextField produced a deprecation warning in every visionOS build of an app using the package. An internal onValueChange(of:perform:) helper uses the two-parameter onChange where it exists and falls back to the old one below iOS 17. It is not public and goes away once the minimum reaches iOS 17.

CachedAsyncImage has the same warning; its fix (.task(id:)) comes with the CachedAsyncImage PR.

Split out of #7.

How this was verified

Generic visionOS build (xcodebuild -scheme HandySwiftUI -destination 'generic/platform=visionOS'), onChange deprecation warnings:

main:
CachedAsyncImage.swift:125:8: warning: 'onChange(of:perform:)' was deprecated in visionOS 1.0
LimitedTextField.swift:24:14: warning: 'onChange(of:perform:)' was deprecated in visionOS 1.0

this branch:
CachedAsyncImage.swift:125:8: warning: 'onChange(of:perform:)' was deprecated in visionOS 1.0

The iOS build succeeds as well. Behavior is unchanged: both variants call the action with the new value.

onChange(of:perform:) is deprecated starting with iOS 17 and from the
start on visionOS, so LimitedTextField produced a deprecation warning
there. An internal onValueChange helper picks the two-parameter variant
where it exists and falls back to the old one below iOS 17. It is not
public and goes away once the minimum reaches iOS 17.
@Jeehut
Jeehut merged commit b68a012 into main Oct 15, 2026
5 checks passed
@Jeehut
Jeehut deleted the wip/onchange-visionos branch October 15, 2026 10:07
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