بنقرة واحدة
documentation
Generate comprehensive API documentation using DocC (Swift-DocC) for your PaleoRose project
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Generate comprehensive API documentation using DocC (Swift-DocC) for your PaleoRose project
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| description | Generate comprehensive API documentation using DocC (Swift-DocC) for your PaleoRose project |
Generate comprehensive API documentation using DocC (Swift-DocC) for your PaleoRose project.
DocC Documentation
Code Comment Enhancement
Documentation Structure
Rich Content
Export Formats
When invoked, this skill will:
When the user invokes this skill:
Ask what to document:
Choose documentation style:
Generate documentation structure
Build DocC catalog
Export to desired format
Your key documentation targets:
/// A petal-shaped graphic element for rose diagrams.
///
/// `GraphicPetal` renders a wedge-shaped petal extending from the center
/// of a rose diagram, with its radius determined by the data value it represents.
///
/// ## Overview
///
/// Petals are the primary visual elements in rose diagrams, showing directional
/// data distribution. Each petal represents a bin of directional measurements,
/// with its length proportional to the frequency or magnitude of measurements
/// in that direction.
///
/// ## Topics
///
/// ### Creating Petals
///
/// - ``init(controller:forIncrement:forValue:)``
///
/// ### Geometry Calculation
///
/// - ``calculateGeometry()``
/// - ``petalIncrement``
/// - ``maxRadius``
/// - ``percent``
///
/// ### Drawing
///
/// - ``drawingPath``
/// - ``lineWidth``
@objc class GraphicPetal: Graphic {
// ...
}
/// Creates a new petal graphic with the specified parameters.
///
/// - Parameters:
/// - controller: The geometry controller providing drawing parameters
/// such as center point, maximum radius, and angular spacing.
/// - increment: The zero-based index of this petal's angular position.
/// For a 16-bin rose diagram, valid values are 0-15.
/// - aNumber: The data value for this petal. Interpreted as either
/// a count or percentage depending on the geometry controller's
/// configuration.
///
/// - Returns: A configured petal graphic, or `nil` if the geometry
/// controller cannot provide valid parameters.
///
/// ## Example
///
/// ```swift
/// let controller = MyGeometryController()
/// let petal = GraphicPetal(
/// controller: controller,
/// forIncrement: 0, // North direction
/// forValue: NSNumber(value: 25.5)
/// )
/// ```
@objc init?(
controller: GraphicGeometrySource,
forIncrement increment: Int32,
forValue aNumber: NSNumber
) {
// ...
}
/// The line width used when stroking the petal's outline.
///
/// When this property changes, the underlying ``drawingPath`` is automatically
/// updated to use the new line width. The default value is inherited from
/// the ``Graphic`` base class.
///
/// - Note: Line width is measured in points and should typically range
/// from 0.5 to 3.0 for optimal appearance.
override var lineWidth: Float {
didSet {
drawingPath?.lineWidth = CGFloat(lineWidth)
}
}
/// A type that can be represented as a SQLite database table.
///
/// Conforming types can be automatically encoded to and decoded from
/// SQLite databases using the CodableSQLiteNonThread framework.
///
/// ## Overview
///
/// Types conforming to `TableRepresentable` must:
/// 1. Conform to `Codable` for serialization
/// 2. Provide a unique table name
/// 3. Optionally specify a primary key column
/// 4. Implement query generation methods
///
/// ## Topics
///
/// ### Required Properties
///
/// - ``tableName``
/// - ``primaryKey``
///
/// ### Query Generation
///
/// - ``createTableQuery()``
/// - ``insertQuery()``
/// - ``updateQuery()``
/// - ``deleteQuery()``
/// - ``countQuery()``
///
/// ### Value Binding
///
/// - ``valueBindables(keys:)``
///
/// ## Example
///
/// ```swift
/// struct Layer: TableRepresentable {
/// static var tableName: String { "Layer" }
/// static var primaryKey: String? { "id" }
///
/// let id: UUID
/// let name: String
/// let layerType: Int
/// }
/// ```
public protocol TableRepresentable: Codable {
static var tableName: String { get }
static var primaryKey: String? { get }
// ...
}
/// Angle manipulation utilities.
///
/// These extensions provide common operations for working with angles
/// in both degrees and radians, essential for rose diagram calculations.
extension CGFloat {
/// Normalizes an angle to the 0-360 degree range.
///
/// This method ensures angles are always positive and within a single
/// rotation, making comparisons and calculations more reliable.
///
/// - Returns: The normalized angle in degrees.
///
/// ## Example
///
/// ```swift
/// let angle1 = CGFloat(450).normalizedAngle() // 90.0
/// let angle2 = CGFloat(-30).normalizedAngle() // 330.0
/// ```
func normalizedAngle() -> CGFloat {
var angle = self
while angle < 0 {
angle += 360
}
while angle >= 360 {
angle -= 360
}
return angle
}
/// Converts degrees to radians.
var radians: CGFloat {
self * .pi / 180.0
}
/// Converts radians to degrees.
var degrees: CGFloat {
self * 180.0 / .pi
}
}
PaleoRose.docc/
├── PaleoRose.md # Root documentation page
├── Resources/
│ ├── rose-diagram-example.png
│ ├── layer-hierarchy.png
│ └── database-schema.png
├── Articles/
│ ├── GettingStarted.md
│ ├── RoseDiagrams.md
│ ├── DatabaseModel.md
│ └── GraphicsArchitecture.md
└── Tutorials/
├── PaleoRose.tutorial
├── CreatingRoseDiagram.tutorial
└── WorkingWithLayers.tutorial
# ``PaleoRose``
A macOS application for creating and analyzing rose diagrams from paleontological data.
## Overview
PaleoRose provides tools for visualizing directional data using rose diagrams,
circular histograms, and other specialized plots commonly used in geology and
paleontology.
## Topics
### Essentials
- <doc:GettingStarted>
- <doc:RoseDiagrams>
- <doc:DatabaseModel>
### Graphics and Visualization
- ``Graphic``
- ``GraphicPetal``
- ``GraphicCircle``
- ``GraphicKite``
- ``GraphicHistogram``
### Data Model
- ``DocumentModel``
- ``InMemoryStore``
- ``Layer``
- ``DataSet``
### Database Framework
- ``TableRepresentable``
- ``SQLiteInterface``
- ``Query``
### Utilities
- <doc:GraphicsArchitecture>
- ``CGFloat`` extensions
- ``NSBezierPath`` extensions
@Tutorial(time: 20) {
@Intro(title: "Creating Your First Rose Diagram") {
Learn how to create and customize a rose diagram to visualize
directional data.
@Image(source: "rose-diagram-intro.png", alt: "A completed rose diagram")
}
@Section(title: "Setting Up Your Data") {
@ContentAndMedia {
First, import your directional measurements into PaleoRose.
@Image(source: "data-import.png", alt: "Data import dialog")
}
@Steps {
@Step {
Create a new document.
@Code(name: "CreateDocument.swift", file: 01-create-document.swift)
}
@Step {
Add your measurements to the dataset.
@Code(name: "AddData.swift", file: 02-add-data.swift)
}
}
}
@Section(title: "Creating the Diagram") {
@ContentAndMedia {
Configure the rose diagram visualization settings.
}
@Steps {
@Step {
Create a data layer.
@Code(name: "CreateLayer.swift", file: 03-create-layer.swift)
}
@Step {
Configure petal graphics.
@Code(name: "ConfigurePetals.swift", file: 04-configure-petals.swift)
}
}
}
@Assessments {
@MultipleChoice {
What does the length of a petal represent in a rose diagram?
@Choice(isCorrect: false) {
The angle of the measurement
@Justification(isCorrect: false) {
The angle is represented by the petal's position, not its length.
}
}
@Choice(isCorrect: true) {
The frequency of measurements in that direction
@Justification(isCorrect: true) {
Correct! Petal length shows how many measurements fall within
that directional bin.
}
}
}
}
}
# Build documentation in Xcode
xcodebuild docbuild \
-scheme PaleoRose \
-derivedDataPath ./DocBuild
# Find generated .doccarchive
find ./DocBuild -name "*.doccarchive"
# Install swift-docc-plugin
swift package plugin generate-documentation \
--target PaleoRose \
--output-path ./docs
# Preview documentation
swift package plugin preview-documentation \
--target PaleoRose
# Generate static HTML site
swift package plugin generate-documentation \
--target PaleoRose \
--hosting-base-path /PaleoRose \
--output-path ./docs
# Serve locally
python3 -m http.server --directory ./docs 8000
Generate documentation for:
Each should have:
#!/usr/bin/swift
import Foundation
// Scan Swift files for missing documentation
let fileManager = FileManager.default
let projectPath = "./PaleoRose"
func auditDocumentation(in directory: String) {
// Find all Swift files
// Parse for public declarations
// Check for doc comments
// Report missing documentation
}
struct DocumentationGap {
let file: String
let line: Int
let declaration: String
let type: DeclarationType
enum DeclarationType {
case `class`, `struct`, `enum`, `protocol`
case method, property, initializer
}
}
// Generate report
print("Documentation Coverage Report")
print("==============================")
print("")
print("Missing Documentation:")
// ... output gaps
print("")
print("Coverage: \(coveredCount)/\(totalCount) (\(percentage)%)")
Write for Your Audience
Use Active Voice
Be Concise
Provide Context
Include Examples
Link Related Items
Type for symbolsKeep It Updated
name: Documentation
on:
push:
branches: [main]
pull_request:
jobs:
build-docs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Build Documentation
run: |
swift package plugin generate-documentation \
--target PaleoRose \
--output-path ./docs
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
Store documentation settings in .docc-config.json:
{
"hostingBasePath": "/PaleoRose",
"targets": ["PaleoRose", "CodableSQLiteNonThread"],
"outputPath": "./docs",
"theme": {
"color": "#007AFF",
"iconPath": "./Resources/icon.png"
},
"excludedPaths": [
"*/Tests/*",
"*/Mocks/*"
],
"generateTutorials": true,
"generateArticles": true
}
Analyze and optimize Xcode asset catalogs - find unused assets, missing resolutions, compress images
Analyze and optimize Xcode build times by identifying slow compilation units and suggesting improvements
Generate CI/CD configurations and automation scripts for building, testing, and deploying
Calculate code quality metrics - complexity, coverage, maintainability
Parse and analyze macOS crash logs to identify crash causes and debugging information
Parse and validate XIB/Storyboard files for broken outlets, warnings, accessibility