You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the recently added Observation framework in Swift, the Observable macro is currently only applicable to classes and not structs. There is a comment in ObservableMacro.swift at line 212 stating// structs are not yet supported; copying/mutation semantics tbd. This comment might lead developers to expect that support for structs could be added in the future. However, discussions on the Swift forum (link here) indicate that monitoring structs in Swift presents challenges. Therefore, I believe it would be appropriate to remove the word "yet" from the comment to provide clearer information about the current scope of support.
Solution
A solution to this issue would be to revise the comment to more accurately reflect the current situation and future plans regarding support. For example, the comment could be rephrased to: structs are currently not supported due to copying/mutation semantics. Future support will depend on ongoing discussions and feasibility. Such a change would help ensure that developers do not have misconceptions about the current state of support and future direction.
Alternatives considered
An alternative approach to address this issue could be to add documentation explaining the technical challenges of supporting structs, based on discussions in the forum. This would provide developers with a deeper understanding of why structs are not currently supported at this time.
The text was updated successfully, but these errors were encountered:
Motivation
In the recently added Observation framework in Swift, the Observable macro is currently only applicable to classes and not structs. There is a comment in ObservableMacro.swift at line 212 stating
// structs are not yet supported; copying/mutation semantics tbd.
This comment might lead developers to expect that support for structs could be added in the future. However, discussions on the Swift forum (link here) indicate that monitoring structs in Swift presents challenges. Therefore, I believe it would be appropriate to remove the word "yet" from the comment to provide clearer information about the current scope of support.Solution
A solution to this issue would be to revise the comment to more accurately reflect the current situation and future plans regarding support. For example, the comment could be rephrased to:
structs are currently not supported due to copying/mutation semantics. Future support will depend on ongoing discussions and feasibility.
Such a change would help ensure that developers do not have misconceptions about the current state of support and future direction.Alternatives considered
An alternative approach to address this issue could be to add documentation explaining the technical challenges of supporting structs, based on discussions in the forum. This would provide developers with a deeper understanding of why structs are not currently supported at this time.
The text was updated successfully, but these errors were encountered: