Skip to content

Change keypath BindingTarget.init to solve source breaking change in SE-0481 #890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mluisbrown
Copy link
Contributor

@mluisbrown mluisbrown commented Jun 9, 2025

Fixes: #889

SE-0481 would break the current version of the BindingTarget.init that takes a keypath. Changing the keypath type from WritableKeyPath to ReferenceWritableKeyPath fixes this, and is probably what the type should always have been, since Object will always be a reference type.

Despite the signature of the initalizer changing, this is unlikely to break existing code using it, as the keypath is almost always passed using keypath notation (eg : \.property) and not using an explicit keypath type.

Checklist

  • Updated CHANGELOG.md.

ReferenceWritableKeyPath instead of a WritableKeyPath
in order to resolve source breaking change in SE-0481.
@mluisbrown mluisbrown requested a review from Copilot June 9, 2025 16:56
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a source-breaking issue with SE-0481 by changing the key path type in the BindingTarget initializer.

  • Updated the initializer to use ReferenceWritableKeyPath instead of WritableKeyPath.
  • The change ensures that the key path parameter is appropriate for object reference types.
Comments suppressed due to low confidence (1)

Sources/UnidirectionalBinding.swift:188

  • Update the documentation comment to indicate that the keyPath parameter now expects a ReferenceWritableKeyPath to match the new API signature.
public init<Object: AnyObject>(on scheduler: Scheduler = ImmediateScheduler(), lifetime: Lifetime, object: Object, keyPath: ReferenceWritableKeyPath<Object, Value>) {

@mluisbrown mluisbrown self-assigned this Jun 9, 2025
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.

BindingTarget.init should probably take a ReferenceWritableKeyPath
1 participant