Hello Apple SwiftUI / Swift Charts Engineering Team,
I am writing to report a layout regression regarding Swift Charts in iOS 27. The multiLabelAlignment property on AxisValueLabel has stopped working as expected, whereas it functions perfectly in iOS 26.
Bug Description:
When configuring custom string values within AxisMarks using AxisValueLabel with multiLabelAlignment: .trailing, the alignment configuration is completely ignored on iOS 27. Labels fail to align text properly to the trailing edge, causing rendering layout issues for multi-line or custom text labels on the Y-axis. This exact same implementation compiles and aligns correctly on iOS 26.
Code Snippet to Reproduce:
swift
struct YAxisAlignmentBugView: View {
// data points to render the chart frame
let data = [(date: Date(), revenue: 3000.0), (date: Date().addingTimeInterval(10000), revenue: 4000.0)]
var body: some View {
Chart(data, id: .date) { item in
LineMark(x: .value("Date", item.date), y: .value("Revenue", item.revenue))
}
.frame(height: 300)
.padding()
.chartYAxis {
AxisMarks(preset: .aligned, position: .trailing, values: [12.0, 600.0, 3000.0, 6000.0]) { value in
if let revenue = value.as(Double.self) {
// BUG: multiLabelAlignment: .trailing is completely ignored on iOS 27
AxisValueLabel("y-(Int(revenue))", anchor: .leading, multiLabelAlignment: .trailing)
}
}
}
}
}
Steps to Reproduce:
Render a Swift Chart containing a .chartYAxis configuration with position: .trailing.
Pass a string directly using AxisValueLabel(customText, anchor: .leading, multiLabelAlignment: .trailing).
Run the application on an iOS 26 simulator (text aligns properly to the trailing edge).
Run the identical application code on an iOS 27 simulator.
Expected Behavior:
The text inside the AxisValueLabel should honor the multiLabelAlignment: .trailing parameter and align the text strings flush right.
Actual Behavior:
The multiLabelAlignment layout modifier is ignored on iOS 27, resulting in unexpected default left-alignment of the text strings.
Attachments:
I have attached screenshots from the Xcode Simulator demonstrating the regression:
Please let me know if you need any further diagnostic details.
Best regards,
Soumyajit Das