Extensions are not visible on Preview blocks in Xcode 15 Beta 2

After updating to Xcode 15 Beta 2, my app stopped building due to complaints that the extensions I defined on MKCoordinateRegion don't exist when used in the Preview. Interestingly, there are no exceptions when these extensions are used elsewhere in the app.

Here's a small code example that I created:

Notice that the exception is only thrown in the preview and not in the body of the struct. This behavior was working as expected in Xcode 15 Beta 1.

Furthermore, this issue arises only when the target is an iPhone or iPad. If I switch the target to Vision Pro, the app builds successfully.

Hi,

Sorry to hear you are having problems getting extensions working in a #Preview working. This is an unfortunate and known issue listed in the release notes for beta 2

#Preview can’t reference symbols in Swift type extensions when they are defined in the same module as the Preview (110671628)

I'm using Version 15.3 (15E204a) and still seeing this problem. For example, a simple extension I use for quick View debugging:

extension View { func redBorder() -> some View { return self.border(Color.red, width: width) } }

Extensions are not visible on Preview blocks in Xcode 15 Beta 2
 
 
Q