Skip to content

Commit 73fb1d1

Browse files
authored
Merge pull request #4 from ImpostersLimited/codex/docc-tooling-support
Add DocC and docs tooling support
2 parents dc9ea62 + 6432d7d commit 73fb1d1

90 files changed

Lines changed: 1419 additions & 27 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docs.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Documentation
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- ".github/workflows/docs.yml"
7+
- "CHANGELOG.md"
8+
- "Package.swift"
9+
- "README.md"
10+
- "Sources/**"
11+
- "docs/**"
12+
push:
13+
branches:
14+
- main
15+
paths:
16+
- ".github/workflows/docs.yml"
17+
- "CHANGELOG.md"
18+
- "Package.swift"
19+
- "README.md"
20+
- "Sources/**"
21+
- "docs/**"
22+
23+
jobs:
24+
docbuild:
25+
runs-on: macos-latest
26+
27+
steps:
28+
- name: Check out repository
29+
uses: actions/checkout@v4
30+
31+
- name: Build DocC catalog
32+
run: |
33+
xcodebuild docbuild \
34+
-scheme SimpleChart \
35+
-destination 'platform=macOS' \
36+
-derivedDataPath .build/DerivedData \
37+
CODE_SIGNING_ALLOWED=NO

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
- Public interaction helper types: `SCChartSelectionState`, `SCChartInspectionOverlay`, `SCChartScrollBehavior`, `SCChartGestureConfiguration`, and `SCChartHoverState`.
2323
- Viewport coordination helpers for centered, clamped, and zoomed visible-window updates.
2424
- Focused tests for the interaction-helper slice, including interaction helper state, wrapper configuration, and viewport utilities.
25+
- Zoomable navigation helpers: `SCChartTimeViewport`, `SCChartZoomBehavior`, and `SCChartNavigationCoordinator`.
26+
- Viewport-driven zoom support for `SCScrollableLineChart` and `SCScrollableTimeSeriesChart`, including focused tests for indexed and time-series navigation state.
2527
- Helper-style annotation presets for caption, badge, and formatted value-label rendering via `SCChartAnnotation`.
2628
- Availability-gated `SCSelectableSectorChart` and `SCSelectableDonutChart` wrappers for `SectorMark` angle-selection workflows on newer OS versions.
2729
- Focused tests for selectable sector/donut wrapper configuration and annotation helper presets.
@@ -33,6 +35,8 @@
3335
- Visible-domain and scroll-behavior presets for analytics- and finance-style windows.
3436
- Focused tests for inspection-wrapper configuration and time-series selection state.
3537
- A new `docs/tutorials/` learning path with sequenced tutorials for first chart setup, helper-first data construction, interactions, time-series, composed charts, and legacy migration.
38+
- A first-party `SimpleChart.docc` catalog with package overview and focused articles for getting started, wrapper selection, interactive charts, and legacy migration.
39+
- A contributor-facing `docs/editor-support.md` guide covering Xcode Quick Help, local DocC builds, and `sourcekit-lsp` usage.
3640
- Availability-gated vectorized plot wrappers: `SCNativeLinePlotChart`, `SCNativeAreaPlotChart`, `SCNativeBarPlotChart`, `SCNativePointPlotChart`, and `SCNativeRectanglePlotChart`.
3741
- Availability-gated function and parametric plot wrappers: `SCNativeFunctionLinePlotChart`, `SCNativeParametricLinePlotChart`, and `SCNativeFunctionAreaPlotChart`.
3842
- Availability-gated 3D wrappers and helpers: `SCChart3DPoint`, `SCChart3DPoseStyle`, `SCChart3DSeriesStyle`, `SCNative3DPointChart`, `SCNative3DRectangleChart`, `SCNative3DRuleChart`, and `SCNativeSurfacePlotChart`.
@@ -47,7 +51,8 @@
4751

4852
### Changed
4953

50-
- Added Xcode Quick Help documentation to the first-discovery public API surface so the core models, styles, composition entrypoints, and primary wrappers are easier to explore directly from Xcode.
54+
- Added Xcode Quick Help documentation across the full exposed package API surface, including the native wrapper/helper layer and the deprecated compatibility layer, so every public type and entry point is easier to discover directly from Xcode.
55+
- Added richer Quick Help coverage for the zoom/navigation surface, including `SCChartTimeViewport`, `SCChartScrollBehavior`, `SCChartZoomBehavior`, and the scrollable interactive wrappers.
5156
- Raised minimum supported platform versions to Swift Charts baselines:
5257
- iOS 16+
5358
- macOS 13+
@@ -66,7 +71,9 @@
6671
- Refactored composed-chart annotation rendering and sector-selection overlays to use the shared `SCChartAnnotationLabelView` helper path.
6772
- Refactored selection and hover inspection rendering to share the same callout and value-label helper path.
6873
- Reworked the documentation entrypoint around a real quick-start flow, with dedicated getting-started and chart-selection guides for new users.
74+
- Added repository-level documentation discovery links for the DocC catalog and editor support guide, plus a CI docbuild path for keeping the package documentation healthy.
6975
- Expanded the README wrapper catalog and coverage/status sections to include the vectorized plot and 3D chart surface.
76+
- Updated the scrolling and time-series docs to show viewport-based zoom configuration for indexed and date-based interactive wrappers.
7077

7178
### Deprecated
7279

README.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ If you are new to the package, start here instead of reading the full README top
1111
3. Use the focused guides below when you need the next step
1212

1313
- [Getting Started](docs/getting-started.md)
14+
- [DocC Catalog Source](Sources/SimpleChart/SimpleChart.docc/SimpleChart.md)
1415
- [Tutorials](docs/tutorials/README.md)
1516
- [Chart Selection Guide](docs/chart-selection-guide.md)
17+
- [Editor Support](docs/editor-support.md)
1618
- [Migration from the legacy API](#migration-from-the-legacy-api)
1719

1820
## Platform requirements
@@ -41,10 +43,10 @@ The native layer is built around a small shared model surface:
4143
- `SCChartSectorSegment` for sector and donut charts
4244
- `SCChartBarGroup` and `SCChartStackSegment` for grouped and stacked bars
4345
- `SCChartTimePoint` for time-series datasets
44-
- `SCChartVisibleDomain` and `SCChartViewport` for scroll-window helpers
46+
- `SCChartVisibleDomain`, `SCChartViewport`, and `SCChartTimeViewport` for scroll-window helpers
4547
- `SCChartNumericValueFormat` and `SCChartDateValueFormat` for helper-style axis formatting
4648
- `SCChartSelection` for wrapper-managed chart selection state
47-
- `SCChartSelectionState`, `SCChartInspectionOverlay`, `SCChartScrollBehavior`, `SCChartGestureConfiguration`, and `SCChartHoverState` for reusable interaction configuration
49+
- `SCChartSelectionState`, `SCChartInspectionOverlay`, `SCChartScrollBehavior`, `SCChartZoomBehavior`, `SCChartGestureConfiguration`, and `SCChartHoverState` for reusable interaction configuration
4850
- `SCChartMark` for composed mark-based chart definitions
4951
- `SCChartAnnotationStyle`, `SCChartAnnotation`, `SCChartOverlay`, `SCChartScale`, and `SCChartComposition` for reusable composed-chart helpers
5052

@@ -163,6 +165,14 @@ let scrollBehavior = SCChartScrollBehavior.continuous(.points(7))
163165
let timeWindow = SCChartScrollBehavior.timeWindow(hours: 24)
164166
let analyticsScroll = SCChartScrollBehavior.analytics(points: 21)
165167
let financeScroll = SCChartScrollBehavior.finance(tradingDays: 10)
168+
let timeViewport = SCChartTimeViewport.starting(
169+
at: Date(timeIntervalSince1970: 1_700_000_000),
170+
duration: 60 * 60 * 24
171+
)
172+
let zoomBehavior = SCChartZoomBehavior(
173+
minimumVisibleLength: 3,
174+
maximumVisibleLength: 14
175+
)
166176
let gestures = SCChartGestureConfiguration.interactive
167177
let compositionScale = SCChartScale(
168178
xVisibleDomain: .points(6),
@@ -356,7 +366,10 @@ struct RevenueExplorer: View {
356366
@State private var selectionState = SCChartSelectionState()
357367
@State private var hoverState: SCChartHoverState?
358368
@State private var viewport = SCChartViewport.starting(at: 0, length: 7)
359-
@State private var scrollPosition = Date(timeIntervalSince1970: 1_700_000_000)
369+
@State private var timeViewport = SCChartTimeViewport.starting(
370+
at: Date(timeIntervalSince1970: 1_700_000_000),
371+
duration: 7_200
372+
)
360373

361374
let points = SCChartPoint.make(
362375
labeledValues: [("Mon", 12), ("Tue", 18), ("Wed", 15), ("Thu", 20)]
@@ -394,14 +407,16 @@ struct RevenueExplorer: View {
394407
points: points,
395408
viewport: $viewport,
396409
scrollBehavior: .continuous(.points(3)),
410+
zoomBehavior: .init(minimumVisibleLength: 2, maximumVisibleLength: 7),
397411
gestureConfiguration: .interactive,
398412
yAxisFormat: .number(precision: 0)
399413
)
400414

401415
SCScrollableTimeSeriesChart(
402416
points: history,
403-
scrollPosition: $scrollPosition,
417+
viewport: $timeViewport,
404418
scrollBehavior: .timeWindow(seconds: 7_200),
419+
zoomBehavior: .init(minimumVisibleLength: 1_800, maximumVisibleLength: 14_400),
405420
xAxisFormat: .hourMinute,
406421
gestureConfiguration: .scrollOnly,
407422
yAxisFormat: .compact

Sources/SimpleChart/Native/Charts/SCHoverableCharts.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Charts
99
import SwiftUI
1010

1111
@available(iOS 17, macOS 14, tvOS 17, watchOS 10, macCatalyst 17, *)
12+
/// A line chart wrapper with pointer-hover inspection support.
1213
public struct SCHoverableLineChart: View {
1314
public let points: [SCChartPoint]
1415
public let seriesStyle: SCChartSeriesStyle
@@ -20,6 +21,7 @@ public struct SCHoverableLineChart: View {
2021

2122
@Binding private var hoverState: SCChartHoverState?
2223

24+
/// Creates a hoverable line chart bound to external hover state.
2325
public init(
2426
points: [SCChartPoint],
2527
hoverState: Binding<SCChartHoverState?>,
@@ -153,6 +155,7 @@ public struct SCHoverableLineChart: View {
153155
}
154156

155157
@available(iOS 17, macOS 14, tvOS 17, watchOS 10, macCatalyst 17, *)
158+
/// A bar chart wrapper with pointer-hover inspection support.
156159
public struct SCHoverableBarChart: View {
157160
public let points: [SCChartPoint]
158161
public let seriesStyle: SCChartSeriesStyle
@@ -163,6 +166,7 @@ public struct SCHoverableBarChart: View {
163166

164167
@Binding private var hoverState: SCChartHoverState?
165168

169+
/// Creates a hoverable bar chart bound to external hover state.
166170
public init(
167171
points: [SCChartPoint],
168172
hoverState: Binding<SCChartHoverState?>,
@@ -270,6 +274,7 @@ public struct SCHoverableBarChart: View {
270274
}
271275

272276
@available(iOS 17, macOS 14, tvOS 17, watchOS 10, macCatalyst 17, *)
277+
/// A scatter chart wrapper with pointer-hover inspection support.
273278
public struct SCHoverableScatterChart: View {
274279
public let points: [SCChartScatterPoint]
275280
public let seriesStyle: SCChartSeriesStyle
@@ -280,6 +285,7 @@ public struct SCHoverableScatterChart: View {
280285

281286
@Binding private var hoverState: SCChartHoverState?
282287

288+
/// Creates a hoverable scatter chart bound to external hover state.
283289
public init(
284290
points: [SCChartScatterPoint],
285291
hoverState: Binding<SCChartHoverState?>,

Sources/SimpleChart/Native/Charts/SCInspectionWrappers.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ public struct SCCrosshairScatterChart: View {
313313
}
314314

315315
@available(iOS 17, macOS 14, tvOS 17, watchOS 10, macCatalyst 17, *)
316+
/// A time-series wrapper that always shows inspector-style selection callouts.
316317
public struct SCInspectorTimeSeriesChart: View {
317318
public let points: [SCChartTimePoint]
318319
public let seriesStyle: SCChartSeriesStyle
@@ -326,6 +327,7 @@ public struct SCInspectorTimeSeriesChart: View {
326327

327328
@Binding private var selection: SCChartSelection?
328329

330+
/// Creates an inspector-style time-series wrapper bound directly to an optional selection.
329331
public init(
330332
points: [SCChartTimePoint],
331333
selection: Binding<SCChartSelection?>,
@@ -367,6 +369,7 @@ public struct SCInspectorTimeSeriesChart: View {
367369
}
368370

369371
@available(iOS 17, macOS 14, tvOS 17, watchOS 10, macCatalyst 17, *)
372+
/// A time-series wrapper that always shows crosshair-style selection guides.
370373
public struct SCCrosshairTimeSeriesChart: View {
371374
public let points: [SCChartTimePoint]
372375
public let seriesStyle: SCChartSeriesStyle
@@ -381,6 +384,7 @@ public struct SCCrosshairTimeSeriesChart: View {
381384

382385
@Binding private var selection: SCChartSelection?
383386

387+
/// Creates a crosshair-style time-series wrapper bound directly to an optional selection.
384388
public init(
385389
points: [SCChartTimePoint],
386390
selection: Binding<SCChartSelection?>,

Sources/SimpleChart/Native/Charts/SCNative3DCharts.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@
77

88
import SwiftUI
99

10+
#if compiler(>=6.3)
1011
@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
1112
@available(tvOS, unavailable)
1213
@available(watchOS, unavailable)
14+
/// A 3D point chart wrapper built on the package's composed 3D mark layer.
1315
public struct SCNative3DPointChart: View {
1416
public let points: [SCChart3DPoint]
1517
public let style: SCChart3DSeriesStyle
1618
public let pose: SCChart3DPoseStyle
1719

20+
/// Creates a 3D point chart from prebuilt 3D points.
1821
public init(
1922
points: [SCChart3DPoint],
2023
style: SCChart3DSeriesStyle = .init(),
@@ -36,11 +39,13 @@ public struct SCNative3DPointChart: View {
3639
@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
3740
@available(tvOS, unavailable)
3841
@available(watchOS, unavailable)
42+
/// A 3D rectangle chart wrapper built on the package's composed 3D mark layer.
3943
public struct SCNative3DRectangleChart: View {
4044
public let points: [SCChart3DPoint]
4145
public let style: SCChart3DSeriesStyle
4246
public let pose: SCChart3DPoseStyle
4347

48+
/// Creates a 3D rectangle chart from prebuilt 3D points.
4449
public init(
4550
points: [SCChart3DPoint],
4651
style: SCChart3DSeriesStyle = .init(),
@@ -62,11 +67,13 @@ public struct SCNative3DRectangleChart: View {
6267
@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
6368
@available(tvOS, unavailable)
6469
@available(watchOS, unavailable)
70+
/// A 3D rule chart wrapper built on the package's composed 3D mark layer.
6571
public struct SCNative3DRuleChart: View {
6672
public let points: [SCChart3DPoint]
6773
public let style: SCChart3DSeriesStyle
6874
public let pose: SCChart3DPoseStyle
6975

76+
/// Creates a 3D rule chart from prebuilt 3D points.
7077
public init(
7178
points: [SCChart3DPoint],
7279
style: SCChart3DSeriesStyle = .init(),
@@ -88,6 +95,7 @@ public struct SCNative3DRuleChart: View {
8895
@available(iOS 26.0, macOS 26.0, visionOS 26.0, *)
8996
@available(tvOS, unavailable)
9097
@available(watchOS, unavailable)
98+
/// A 3D surface chart wrapper that samples a function across the rendered surface.
9199
public struct SCNativeSurfacePlotChart: View {
92100
public let xTitle: String
93101
public let yTitle: String
@@ -96,6 +104,7 @@ public struct SCNativeSurfacePlotChart: View {
96104
public let pose: SCChart3DPoseStyle
97105
public let function: @Sendable (Double, Double) -> Double
98106

107+
/// Creates a 3D surface chart from axis titles, style, and a z-value function.
99108
public init(
100109
xTitle: String,
101110
yTitle: String,
@@ -127,3 +136,4 @@ public struct SCNativeSurfacePlotChart: View {
127136
)
128137
}
129138
}
139+
#endif

Sources/SimpleChart/Native/Charts/SCNativeAreaChart.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77

88
import SwiftUI
99

10+
/// A ready-made single-series categorical area chart backed by composed marks.
1011
public struct SCNativeAreaChart: View {
1112
public let points: [SCChartPoint]
1213
public let seriesStyle: SCChartSeriesStyle
1314
public let axesStyle: SCChartAxesStyle
1415
public let domain: SCChartDomain?
1516
public let referenceLines: [SCChartReferenceLine]
1617

18+
/// Creates an area chart from prebuilt categorical points.
1719
public init(
1820
points: [SCChartPoint],
1921
seriesStyle: SCChartSeriesStyle = .area(),
@@ -28,6 +30,7 @@ public struct SCNativeAreaChart: View {
2830
self.referenceLines = referenceLines
2931
}
3032

33+
/// Creates an area chart from floating-point values and optional labels.
3134
public init<T: BinaryFloatingPoint>(
3235
values: [T],
3336
labels: [String]? = nil,

Sources/SimpleChart/Native/Charts/SCNativeBandChart.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import Charts
99
import SwiftUI
1010

11+
/// A chart that renders one or more highlighted y-range bands across shared categories.
1112
public struct SCNativeBandChart: View {
1213
public let categories: [String]
1314
public let bands: [SCChartBand]
@@ -18,6 +19,7 @@ public struct SCNativeBandChart: View {
1819
public let plotStyle: SCChartPlotStyle
1920
public let domain: SCChartDomain?
2021

22+
/// Creates a band chart from explicit categories and prebuilt bands.
2123
public init(
2224
categories: [String],
2325
bands: [SCChartBand],
@@ -44,6 +46,7 @@ public struct SCNativeBandChart: View {
4446
)
4547
}
4648

49+
/// Creates a band chart from floating-point band tuples.
4750
public init<T: BinaryFloatingPoint>(
4851
categories: [String],
4952
bands: [(String, T, T)],
@@ -72,6 +75,7 @@ public struct SCNativeBandChart: View {
7275
)
7376
}
7477

78+
/// Creates a band chart from integer band tuples.
7579
public init<T: BinaryInteger>(
7680
categories: [String],
7781
bands: [(String, T, T)],

Sources/SimpleChart/Native/Charts/SCNativeGoalChart.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import SwiftUI
99

10+
/// A composed chart that overlays goal reference lines on top of bar values.
1011
public struct SCNativeGoalChart: View {
1112
public let points: [SCChartPoint]
1213
public let goal: SCChartReferenceLine
@@ -15,6 +16,7 @@ public struct SCNativeGoalChart: View {
1516
public let axesStyle: SCChartAxesStyle
1617
public let domain: SCChartDomain?
1718

19+
/// Creates a goal chart from prebuilt categorical points and goal lines.
1820
public init(
1921
points: [SCChartPoint],
2022
goal: SCChartReferenceLine,
@@ -32,6 +34,7 @@ public struct SCNativeGoalChart: View {
3234
self.domain = domain ?? .auto(values: points.map(\.value) + referenceValues, baseZero: true)
3335
}
3436

37+
/// Creates a goal chart from floating-point values, optional labels, and goal lines.
3538
public init<T: BinaryFloatingPoint>(
3639
values: [T],
3740
labels: [String]? = nil,

Sources/SimpleChart/Native/Charts/SCNativeGroupedAreaChart.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import Charts
99
import SwiftUI
1010

11+
/// A multi-series grouped area chart built from named line-series models.
1112
public struct SCNativeGroupedAreaChart: View {
1213
public let series: [SCChartLineSeries]
1314
public let axesStyle: SCChartAxesStyle
@@ -16,6 +17,7 @@ public struct SCNativeGroupedAreaChart: View {
1617
public let foregroundStyleScale: SCChartForegroundStyleScale
1718
public let referenceLines: [SCChartReferenceLine]
1819

20+
/// Creates a grouped area chart from prebuilt line-series values.
1921
public init(
2022
series: [SCChartLineSeries],
2123
axesStyle: SCChartAxesStyle = .standard(),

0 commit comments

Comments
 (0)