Chart structure
Help your agent structure charts and surrounding views to avoid updates that do not affect the chart.
SwiftFairy Scroll
Improve rendering and interaction performance by structuring charts and surrounding views to limit unnecessary updates and use Swift Charts APIs effectively.
Help your agent structure charts and surrounding views to avoid updates that do not affect the chart.
Identify API choices that introduce unnecessary rendering work and give your agent guidance to address them.
Find interaction state changes that trigger unnecessary chart updates, helping your agent keep interactions responsive.
Performant Swift Charts flags over 70 issues in your code. Each finding arrives at the line where the issue occurs, with the guidance and code example written for that case.
Your agent skips millions of tokens of reasoning and reads guidance only for the issues flagged.
Follows your view hierarchy across files and presentations, beyond single views and functions.
Built on our books and articles, and Natalia's work on Apple's SwiftUI team.
These examples show the patterns SwiftFairy flags and the guidance your agent can use to address them. Highlighted lines mark the code to review; each finding indicates whether the guidance is a requirement, recommendation, or consideration.
Consider
When a measurement is missing, substituting zero changes what the chart communicates. The appropriate representation depends on whether the chart draws independent marks or connects neighboring observations.
BarMark(
x: .value("Date", reading.date),
y: .value(
"Temperature",
reading.temperature ?? 0
)
)
AreaMark(
x: .value("Date", reading.date),
y: .value(
"Temperature",
reading.temperature ?? 0
)
)
if let temperature = reading.temperature {
BarMark(
x: .value("Date", reading.date),
y: .value(
"Temperature",
temperature
)
)
}
AreaMark(
x: .value("Date", reading.date),
y: .value(
"Temperature",
reading.temperature ?? Double.nan
)
)
For independent bars, omit the mark when its measurement is missing. For an area chart, retain the observation and use Double.nan for the missing value to break the area across the gap. Removing the observation would connect its neighbors.
Consider
When observations represent the same variable, their semantic label should remain consistent. Each observation's value belongs in the second argument to .value, rather than being interpolated into its label.
BarMark(
x: .value("Date", reading.date),
y: .value("Temperature", reading.temperature)
)
.foregroundStyle(by:
.value(
"Status \(reading.status)",
reading.status
)
)
.foregroundStyle(
by: .value("Status", reading.status)
)
Use a consistent dimension label and pass the observation's status as the value. Whether a dynamic label is appropriate depends on the intended semantics.
…and over 70 other issues.
Ask your agent to review a code change or a complete codebase with SwiftFairy. Your agent uses the findings and their accompanying code examples to resolve issues in your code.
How to use SwiftFairyActivate your free trial within the app at any time.
Choose lifetime access, a fixed term, or a subscription for this Scroll, or get all four together in a bundle.
Correct subtle bugs and performance issues in data flow, state ownership, and view updates by using SwiftUI as it was designed to be used.
Build interfaces that adapt to any window size, device, and text size by sizing views flexibly, structuring scrolling content correctly, and choosing the right SwiftUI layout API for each job.
Refine code for clarity, maintainability, and performance through idiomatic use of modern Swift APIs, including modern Swift concurrency and collection processing.