pointfreeco / swift-composable-architecture

A library for building applications in a consistent and understandable way, with composition, testing, and ergonomics in mind.
https://www.pointfree.co/collections/composable-architecture
MIT License
12.22k stars 1.42k forks source link

Macro compilation issue in modularized project #3291

Closed gyulavoros closed 3 weeks ago

gyulavoros commented 3 weeks ago

Description

I'm looking for guidance on how to integrate TCA with multiple feature modules.

Given that multiple framework targets depend on TCA, project compilation breaks with the following Xcode error:

External macro implementation type 'PerceptionMacros.PerceptibleMacro' could not be found for macro 'Perceptible()'

Project setup:

|-- App
|---- FeatureA
|------ TCA
|---- FeatureB
|------ TCA

This setup used to work with older TCA versions (1.11.2 and prior). I have limited knowledge of macro internals and having a hard time to pinpoint what the issue is.

Checklist

Expected behavior

The project compiles.

Actual behavior

Compilation fails with:

External macro implementation type 'PerceptionMacros.PerceptibleMacro' could not be found for macro 'Perceptible()'

CleanShot 2024-08-19 at 20 06 53@2x

Steps to reproduce

I attached a minimal example demonstrating the issue: ModularizedMacroIssue.zip

The Composable Architecture version information

1.13.0

Destination operating system

iOS 17.5

Xcode version information

Xcode 15.4 (15F31d)

Swift Compiler version information

swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0
mbrandonw commented 3 weeks ago

Hi @gyulavoros, this is not an issue with the library per se, and instead most likely an issue with how your project is set up in Xcode. I am going to convert this to a discussion and perhaps someone can help you out over there.