Community-maintained Agent Skills for complete Swift and Apple-platform app delivery.
73
92%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Medium
Suggest reviewing before use
Read this reference only when the task matches the sections below.
Swift Charts inherits the current color scheme automatically. System colors
(.blue, .orange, .green) adapt to light and dark modes without extra code.
Use .chartForegroundStyleScale to define a consistent palette:
Chart(data) { item in
BarMark(
x: .value("Category", item.category),
y: .value("Value", item.value)
)
.foregroundStyle(by: .value("Category", item.category))
}
.chartForegroundStyleScale([
"Electronics": .blue,
"Clothing": .purple,
"Food": .orange,
"Books": .green,
"Other": .gray
])Chart(data) { ... }
.chartPlotStyle { plotArea in
plotArea
.background(.quaternary.opacity(0.3))
.border(.quaternary, width: 0.5)
}.chartXAxisStyle { axis in
axis.background(.blue.opacity(0.05))
}Always preview charts in both light and dark color schemes. In Xcode previews:
#Preview {
ChartView()
.preferredColorScheme(.dark)
}Verify:
Chart(heatMapData) { item in
RectangleMark(
x: .value("Hour", item.hour),
y: .value("Day", item.day)
)
.foregroundStyle(by: .value("Count", item.count))
}
.chartForegroundStyleScale(range: Gradient(colors: [.blue, .yellow, .red]))| Method | Behavior |
|---|---|
.standard | Default. Regions stack on top showing absolute values. |
.normalized | Scales to 0-100% proportional view. |
.center | Baseline centered (streamgraph). |
.unstacked | Overlapping; no stacking. |
AreaMark(
x: .value("Date", item.date),
y: .value("Revenue", item.revenue),
stacking: .normalized
)
.foregroundStyle(by: .value("Category", item.category))| Dimension | Description |
|---|---|
.automatic | Framework decides |
.fixed(CGFloat) | Exact pixel size |
.inset(CGFloat) | Inset from available space |
.ratio(CGFloat) | Proportion of available space (0...1) |
Use for width, height on BarMark and innerRadius, outerRadius on SectorMark.
circle, square, triangle, diamond, pentagon, plus, cross, asterisk
PointMark(x: .value("X", item.x), y: .value("Y", item.y))
.symbol(.diamond)
.symbolSize(80)PointMark(x: .value("X", item.x), y: .value("Y", item.y))
.symbol(by: .value("Category", item.category))PointMark(x: .value("X", item.x), y: .value("Y", item.y))
.symbol {
Image(systemName: "star.fill")
.font(.caption2)
}Use chartOverlay or chartBackground to access ChartProxy:
.chartOverlay { proxy in
GeometryReader { geometry in
Rectangle()
.fill(.clear)
.contentShape(Rectangle())
.gesture(
DragGesture()
.onChanged { value in
let origin = geometry[proxy.plotAreaFrame].origin
let location = CGPoint(
x: value.location.x - origin.x,
y: value.location.y - origin.y
)
if let date: Date = proxy.value(atX: location.x) {
selectedDate = date
}
}
)
}
}| Method | Purpose |
|---|---|
position(forX:) | Data value to screen x-coordinate |
position(forY:) | Data value to screen y-coordinate |
value(atX:as:) | Screen x-coordinate to data value |
value(atY:as:) | Screen y-coordinate to data value |
plotAreaSize | Size of the plot area |
plotAreaFrame | Anchor for the plot area frame |
chartXAxis(_:) / chartXAxis(content:)chartYAxis(_:) / chartYAxis(content:)chartXAxisLabel(...) / chartYAxisLabel(...)chartXAxisStyle(content:) / chartYAxisStyle(content:)chartXScale(domain:range:type:) and variantschartYScale(domain:range:type:) and variantschartZScale(domain:range:type:) for Chart3DchartForegroundStyleScale(_:) -- custom color mappingChart3D with SurfacePlot or 3D mark initializerschart3DPose(_:) for interactive pose bindingchart3DCameraProjection(_:) for orthographic/perspective projectionchartLegend(_:) -- visibilitychartLegend(position:alignment:spacing:) -- positioningchartLegend(position:alignment:spacing:content:) -- custom contentchartXSelection(value:) / chartXSelection(range:)chartYSelection(value:) / chartYSelection(range:)chartAngleSelection(value:) -- for SectorMarkchartScrollableAxes(_:)chartXVisibleDomain(length:) / chartYVisibleDomain(length:)chartScrollPosition(initialX:) / chartScrollPosition(x:)chartScrollTargetBehavior(_:)chartOverlay(alignment:content:) -- with ChartProxychartBackground(alignment:content:) -- with ChartProxychartPlotStyle(content:) -- plot area styling.tessl-plugin
skills
accessorysetupkit
references
activitykit
adattributionkit
references
alarmkit
references
app-clips
app-intents
app-store-optimization
app-store-review
apple-on-device-ai
appmigrationkit
audioaccessorykit
references
authentication
references
avkit
background-processing
references
browserenginekit
callkit
references
carplay
cloudkit
contacts-framework
references
core-bluetooth
references
core-data
core-motion
references
core-nfc
references
coreml
references
cryptokit
cryptotokenkit
references
debugging-instruments
device-integrity
references
dockkit
energykit
references
eventkit
financekit
references
focus-engine
gamekit
healthkit
references
homekit
references
ios-accessibility
ios-app-workflow
references
ios-ettrace-performance
ios-localization
ios-memgraph-analysis
ios-networking
ios-simulator
references
metrickit
references
musickit
references
natural-language
references
paperkit
references
passkit
references
pdfkit
pencilkit
references
permissionkit
references
photokit
push-notifications
realitykit
references
relevancekit
references
scenekit
sensorkit
speech-recognition
references
spritekit
storekit
swift-api-design-guidelines
swift-architecture
references
swift-charts
swift-codable
references
swift-code-review
swift-concurrency
swift-formatstyle
references
swift-language
swift-security
references
swift-testing
swiftdata
swiftlint
swiftui-animation
swiftui-gestures
references
swiftui-layout-components
swiftui-liquid-glass
references
swiftui-patterns
swiftui-performance
swiftui-responsive-layout
swiftui-uikit-interop
swiftui-webkit
tabletopkit
tipkit
vision-framework
weatherkit
references