Skip to content

Xcode 27 State linker error - #241

Closed
Davidkramer1999 wants to merge 1 commit into
pointfreeco:mainfrom
Davidkramer1999:fix-xcode-27-state-linker
Closed

Davidkramer1999 wants to merge 1 commit into
pointfreeco:mainfrom
Davidkramer1999:fix-xcode-27-state-linker

Conversation

@Davidkramer1999

@Davidkramer1999 Davidkramer1999 commented Sep 23, 2026 •

Copy link
Copy Markdown

Suggested title: Work around Xcode 27 @State linker error

Fixes #240.

Summary

Xcode 27 fails to link Sharing in Debug builds because the @State macro does not emit the initialization expression for the generated __generation storage in Shared and SharedReader.

This changes both types to store State<Int> explicitly instead of using the @State macro:

private var generation = State(wrappedValue: 0)

The existing subscription logic now passes generation directly. This preserves the underlying State<Int> behavior while avoiding the broken macro-generated symbol.

Testing

  • Reproduced the two undefined __generation symbols described in Xcode 27.1 Error #240.
  • Verified that an application that previously failed to link builds successfully with Xcode 27 after applying this change.
  • No public API changes.

Verified with the public Xcode 27 release (27A266a), using Swift 6.4.

@Davidkramer1999 Davidkramer1999 changed the title Work around Xcode 27 State linker error Xcode 27 State linker error Sep 23, 2026
@mbrandonw

Copy link
Copy Markdown
Member

Are you sure you are using the most recent version of this library? According to this, this problem was fixed by 2.8.1.

@Davidkramer1999

Copy link
Copy Markdown
Author

You are correct. I have version 2.5.0. When upgrading issue is not present anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Xcode 27.1 Error

2 participants