Runtime crash from SwiftUI.State and variadic types from Xcode 27 Beta 3

I am seeing a weird crash from Xcode 27 Beta 3 when building a variadic type DynamicProperty that also needs SwiftUI.State. This does not crash from Xcode 26.

Here is a repro:

import SwiftUI

struct Repeater<each Input>: DynamicProperty {
  @State private var storage = Storage()

  private var input: (repeat each Input)

  init(_ input: repeat each Input) {
    self.input = (repeat each input)
  }
}

extension Repeater {
  final class Storage {
    
  }
}

@main
struct CrashDemoApp: App {
  private var repeater = Repeater(1)
  
  var body: some Scene {
    WindowGroup {
      EmptyView()
    }
  }
}

Here is the crash:

Thread 1 Queue : com.apple.main-thread (serial)
#0	0x000000019a93aec0 in swift::TargetMetadata<swift::InProcess>::isCanonicalStaticallySpecializedGenericMetadata ()
#1	0x000000019a946b38 in performOnMetadataCache<swift::MetadataResponse, swift_checkMetadataState::CheckStateCallbacks> ()
#2	0x000000019a8c85f0 in swift_checkMetadataState ()
#3	0x00000001004a2c78 in type metadata completion function for Repeater ()
#4	0x000000019a94cfe4 in swift::GenericCacheEntry::tryInitialize ()
#5	0x000000019a94c870 in swift::MetadataCacheEntryBase<swift::GenericCacheEntry, void const*>::doInitialization ()
#6	0x000000019a94f820 in swift::LockingConcurrentMap<swift::GenericCacheEntry, swift::LockingConcurrentMapStorage<swift::GenericCacheEntry, (unsigned short)14>>::getOrInsert<swift::MetadataCacheKey, swift::MetadataRequest&, swift::TargetTypeContextDescriptor<swift::InProcess> const*&, void const* const*&> ()
#7	0x000000019a93c714 in _swift_getGenericMetadata ()
#8	0x00000001004a4190 in __swift_instantiateGenericMetadata ()
#9	0x00000001004a2a5c in type metadata accessor for Repeater ()
#10	0x00000001004a5094 in type metadata accessor for Repeater<Pack{Int}> ()
#11	0x00000001004a4fcc in type metadata completion function for CrashDemoApp ()
#12	0x000000019a9543bc in swift::MetadataCacheEntryBase<(anonymous namespace)::SingletonMetadataCacheEntry, int>::doInitialization ()
#13	0x000000019a8d2ae0 in swift_getSingletonMetadata ()
#14	0x00000001004a479c in type metadata accessor for CrashDemoApp ()
#15	0x00000001004a473c in static CrashDemoApp.$main() ()
#16	0x00000001004a4a34 in main ()
#17	0x0000000186e47e00 in start ()

Here is a repo to demo:

https://github.com/vanvoorden/2026-07-17

Please let me know if you have any ideas about that. Thanks!

This is still broken for me in Xcode 27 Beta 4. :(

Here is a version that crashes without the State macro:

struct Repeater<each Input> {
  private var __storage = SwiftUICore.State._makeStorage({
    Storage()
  })
  
  private var input: (repeat each Input)

  init(_ input: repeat each Input) {
    self.input = (repeat each input)
  }
}

Another repro:

struct Repeater<each Input> {
  private var __storage = LazyState(initialValue: {
    Storage()
  })

  private var input: (repeat each Input)

  init(_ input: repeat each Input) {
    self.input = (repeat each input)
  }
}

Using classic State does not crash:

struct Repeater<each Input> {
  private var __storage = State(initialValue: Storage())

  private var input: (repeat each Input)

  init(_ input: repeat each Input) {
    self.input = (repeat each input)
  }
}

And for some reason I can build from LazyState if I do not save my parameter pack to a stored instance variable:

struct Repeater<each Input> {
  private var __storage = LazyState(initialValue: {
    Storage()
  })

  init(_ input: repeat each Input) { }
}

It also turns out I can also use LazyState if I declare the stored parameter pack variable before I declare the LazyState variable:

struct Repeater<each Input> {
  private var input: (repeat each Input)

  private var __storage = LazyState(initialValue: {
    Storage()
  })

  init(_ input: repeat each Input) {
    self.input = (repeat each input)
  }
}

That one does not crash.

This is still broken for me from Xcode 27 beta 5. But it looks like we did patch a fix on 6.4.^1

@vanvoorden Could you please file a bug report using Feedback Assistant with the sample code that reproduces this issue? Please post the Feedback ID here once you have it.

Runtime crash from SwiftUI.State and variadic types from Xcode 27 Beta 3
 
 
Q