Skip to content

Importing Segment in an Observable Model results in KeyPath conflict #393

@ay8s

Description

@ay8s

Describe the bug
Importing the Segment SDK in a SwiftUI Observable model causes a compiler crash due to a naming conflict with Swift’s built-in KeyPath type. Segment defines a public struct KeyPath in its codebase, which is picked up during Swift macro expansion, leading to a fatal error:

Cannot specialize non-generic type 'KeyPath'

This breaks any use of Swift’s new Observable macro in the same file.

To Reproduce
Steps to reproduce the behavior:

  1. Create a SwiftUI Project with an Observable Model
  2. Import Segment
  3. Compile the project

Expected behavior
Project should compile successfully without failing due to internal name conflicts.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions