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
When both swift-perception & RxSwift are added as dependencies to a project, both packages are imported in a file and one class is decorated with @Perceptible it produces a compilation error.
Checklist
I have determined that this bug is not reproducible using Swift's observation tools. If the bug is reproducible using the @Observable macro or another tool from the Observation framework, please file it directly with Apple.
If possible, I've reproduced the issue using the main branch of this package.
Where Observable is not coming from Observation but from RxSwift (link) which causes a compilation issue as this class is generic but not the base object.
Steps to reproduce
Create a new App with Xcode
Add both swift-perception & RxSwift packages as SPM dependencies on the project (include them in the App dependencies)
Create a new empty file
Import both packages in the file
Add an empty class that is decorated with the @Perceptible macro
Description
When both swift-perception & RxSwift are added as dependencies to a project, both packages are imported in a file and one class is decorated with
@Perceptible
it produces a compilation error.Checklist
@Observable
macro or another tool from theObservation
framework, please file it directly with Apple.main
branch of this package.Expected behavior
The generated code should look like the following:
A very small change but it would negates all potential namespace collision for people that relies on both packages.
Actual behavior
The macro will generate the following code:
Where
Observable
is not coming fromObservation
but fromRxSwift
(link) which causes a compilation issue as this class is generic but not the base object.Steps to reproduce
swift-perception
&RxSwift
packages as SPM dependencies on the project (include them in the App dependencies)@Perceptible
macroThe empty class:
Fortunately, the workaround is to implement the perception macro manually.
Here is a sample project: NamespaceCollisionWithRxSwift.zip
Perception version information
1.4.1
Destination operating system
iOS 18.2
Xcode version information
16.2
Swift Compiler version information
The text was updated successfully, but these errors were encountered: