SwiftUI ​Charts: In iOS 27, annotation overlays exceed the bounds of an annotation

I'm seeing a regression in SwiftUI Charts on iOS 27 beta 1. Any view placed inside a BarMark's overlay annotation no longer receives the size of the parent BarMark. It collapses to zero, so any content sized from geo.size (e.g. a Rectangle meant to fill the bar) renders empty or incorrectly.

Expected: The GeometryReader reports the BarMark's rendered width/height, and the Rectangle fills the BarMark (this is the behavior in iOS 26 and earlier).

Actual: On iOS 27 beta 1, geo.size is effectively zero, so the overlay content has an extremely small size.

I suspect this could be a small bug with the new ContentBuilder / ViewBuilder changes but that's just a hunch.

Here's a code sample which reproduces the issue.

// MARK: - Mock Data Models
struct ScheduleSeries: Identifiable {
    let id = UUID()
    let data: [ScheduleItem]
}

struct ScheduleItem: Identifiable {
    let id = UUID()
    let startDate: Date
    let startHour: Double
    let endHour: Double
    let secondaryText: String?
}

// MARK: - Minimal Reproducible Example
struct ContentView: View {
    // Generate two consecutive days for the mock data
    let mockSchedule: [ScheduleSeries] = [
        ScheduleSeries(data: [
            ScheduleItem(
                startDate: Date(),
                startHour: 9.0,
                endHour: 11.5,
                secondaryText: "Morning Event"
            ),
            ScheduleItem(
                startDate: Calendar.current.date(byAdding: .day, value: 1, to: Date())!,
                startHour: 13.0,
                endHour: 16.0,
                secondaryText: "Afternoon Event"
            )
        ])
    ]
    
    var body: some View {
        VStack(alignment: .leading) {
            Text("FB: Annotation Sizing Bug")
                .font(.headline)
                .padding(.bottom, 8)
            
            Text("Expected: The gray Rectangle should stretch to fill the BarMark.\nActual: GeometryReader/Annotation fails to size to the parent BarMark.")
                .font(.caption)
                .foregroundColor(.secondary)
                .padding(.bottom)

            Chart(mockSchedule) { series in
                ForEach(series.data, id: \.startDate) { element in
                    BarMark(
                        x: .value("Day", element.startDate, unit: .day, calendar: .current),
                        yStart: .value("Start", element.startHour),
                        yEnd: .value("End", element.endHour),
                        width: .ratio(0.99)
                    )
                    .annotation(position: .overlay, alignment: .topLeading) { item in
                        ZStack {
                            VStack(alignment: .leading, spacing: 0) {
                                // BUG DEMONSTRATION:
                                // This GeometryReader and Rectangle previously filled the BarMark, but in Xcode 27 it does not
                                GeometryReader { geo in
                                    Rectangle()
                                        .fill(Color.black.opacity(0.15))
                                        .frame(width: geo.size.width, height: geo.size.height)
                                }
                            }
                            .foregroundColor(.white)
                            .font(.caption2)
                        }
                    }
                }
            }
            .chartYScale(domain: 0...24) // Lock the Y-axis to a 24-hour scale
        }
        .padding()
    }
}

Environment:

  • Xcode 27 beta 1 / iOS 27 beta 1
  • Reproduces on device and Simulator
  • Worked as expected on iOS 26 and earlier

Here's what the issue looks like in our app with zero code changes:

iOS 26

iOS 27

I've filed a feedback report (FB23016343) with a sample project attached.

Has anyone else hit this, or found a workaround for sizing overlay annotation content to a BarMark in iOS 27? Thanks!

SwiftUI ​Charts: In iOS 27, annotation overlays exceed the bounds of an annotation
 
 
Q