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.35k stars 1.44k forks source link

External macro implementation type could not be found #3416

Closed MiguelG97 closed 2 weeks ago

MiguelG97 commented 2 weeks ago

Description

Can someone guide me on how to set up my project to not have the following issues when implementing TCA? Github repo:

External macro implementation type 'ComposableArchitectureMacros.ReducerMacro' could not be found for macro 'Reducer()

External macro implementation type 'ComposableArchitectureMacros.ObservableStateMacro' could not be found for macro 'ObservableState()'

External macro implementation type 'ComposableArchitectureMacros.ReducerMacro' could not be found for macro 'Reducer()'

Checklist

Expected behavior

xcode to not throw errors

Actual behavior

xcode is throwing errors

Reproducing project

Github repo:

All I did is installed the TCA package through SPM. Once finished I added the library to my target project. Then, when trying to implement the code a bunch of messages show up:

import ComposableArchitecture

@Reducer
struct LayoutSlice {

    @ObservableState
    struct State{
        var isLandScape = false
    }

    enum Action{
        case setLandScape
    }

    var body: some ReducerOf<Self>{
        Reduce{ state, action in
            switch action{
            case .setLandScape:
                state.isLandScape = true
                return .none
            }
        }

    }
}

The Composable Architecture version information

1.15.0

Destination operating system

IOS 17.5

Xcode version information

No response

Swift Compiler version information

No response

mbrandonw commented 2 weeks ago

Hi @MiguelG97, this project builds just fine for me without any errors. There is a chance you have not enabled macros for your project. In the build errors for your project you may see a number of errors like this:

Screenshot 2024-09-30 at 10 15 25 AM

If you enable all of those it should work fine.

Since this isn't an issue with the library I am going to convert it to a discussion. Please feel free to continue the conversation over there!