pointfreeco/swift-composable-architecture

TCA release 1.10.0 and Swift Perception 1.1.6 mismatch

Closed this issue · 1 comments

Description

Installing the latest version of TCA 1.10.0 pulls down the latest version of Swift Perception 1.1.6 in a new project which will not compile due to the change/fix for pointfreeco/swift-perception#64.

Checklist

  • I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue or discussion.

Expected behavior

I should be able to install the latest release of TCA and be able to compile an empty new project.

Actual behavior

Adding TCA 1.10.0 to the project will download Swift Perceptions 1.1.6 which requires that the ObservationStateRegistrar use of self.registrar.access(subject, keyPath: keyPath) in:

    @available(iOS 17, macOS 14, tvOS 17, watchOS 10, *)
    extension ObservationStateRegistrar {
      /// Registers access to a specific property for observation.
      ///
      /// - Parameters:
      ///   - subject: An instance of an observable type.
      ///   - keyPath: The key path of an observed property.
      @inlinable
      public func access<Subject: Observable, Member>(
        _ subject: Subject,
        keyPath: KeyPath<Subject, Member>
      ) {
        self.registrar.access(subject, keyPath: keyPath)
      }

as well as self.registrar.withMutation(of: subject, keyPath: keyPath)

      @inlinable
      public func mutate<Subject: Observable, Member, Value>(
        _ subject: Subject,
        keyPath: KeyPath<Subject, Member>,
        _ value: inout Value,
        _ newValue: Value,
        _ isIdentityEqual: (Value, Value) -> Bool
      ) {
        if isIdentityEqual(value, newValue) {
          value = newValue
        } else {
          self.registrar.withMutation(of: subject, keyPath: keyPath) {
            value = newValue
          }
        }
      }

require @available(iOS 17.0.1, macOS 14, tvOS 17.0.1, watchOS 10.0.1, *) but it is marked as 17.0.0 @available(iOS 17, macOS 14, tvOS 17, watchOS 10, *).

A brand new project will not compile due to this. Workaround is to explicitly import Swift Perceptions 1.1.5 into your project.

Steps to reproduce

  1. Create a new Xcode Project
  2. Add the TCA dependency of version 1.10.0
  3. Attempt to run the app

The Composable Architecture version information

1.10.0

Destination operating system

iOS 17

Xcode version information

Xcode 15.3

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

Hi @Cordavi, you can explicitly pin to 1.1.5 of swift-perception to fix this right now, and then once we merge and release #3025 it will be fixed for TCA too.