Add comprehensive Apple-style documentation for DocC support#8
Conversation
Co-authored-by: aromanov91 <[email protected]>
Co-authored-by: aromanov91 <[email protected]>
Co-authored-by: aromanov91 <[email protected]>
…nsions Co-authored-by: aromanov91 <[email protected]>
There was a problem hiding this comment.
Pull Request Overview
This PR enhances documentation throughout the OversizeCore library to meet Apple’s DocC standards and to improve developer experience by providing detailed inline documentation and examples for public APIs.
- Comprehensive Apple-style documentation added for logging, delay functions, and various Swift extension utilities.
- README.md overhaul with detailed feature overview, installation instructions, and usage examples.
- Documentation updates cover global utilities, Swift standard library extensions, UI-related extensions, and platform-specific utilities.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Sources/OversizeCore/Global/Log.swift | Updated logging functions with comprehensive documentation, though a few emoji usage inconsistencies were noted. |
| Sources/OversizeCore/Global/Delay.swift | Added detailed DocC-style documentation for legacy and modern async delay functions. |
| Sources/OversizeCore/Extensions/Swift/String+Extension.swift | Enhanced documentation for string utilities with usage examples and improved clarity. |
| Sources/OversizeCore/Extensions/Swift/Optional+Extension.swift | Detailed DocC documentation added for safe optional unwrapping methods. |
| Sources/OversizeCore/Extensions/Swift/Number+Extension.swift | Added comprehensive inline documentation for number formatting and conversions. |
| Sources/OversizeCore/Extensions/Swift/Bool+Extension.swift | Introduced iOS version availability check documentation with clear examples. |
| Sources/OversizeCore/Extensions/Swift/Array+Extension.swift | Improved documentation for collection manipulation and JSON serialization features. |
| Sources/OversizeCore/Extensions/Color/Color+Hex.swift | Added robust documentation for hex color conversion and initialization functionalities. |
| Sources/OversizeCore/Extensions/Color/Color+Extension.swift | Provided comprehensive documentation on color manipulation functions including brightness adjustment and random color generation. |
| README.md | Revamped documentation for project overview, installation, and detailed usage examples. |
| /// ``` | ||
| @inlinable public func logUI(_ text: String, terminator: String? = nil) { | ||
| #if DEBUG | ||
| terminator == nil ? print("🖥️ [UI] \(text)") : print("⚪ [UI] \(text)", terminator: terminator!) |
There was a problem hiding this comment.
In logUI, different emojis are used when a terminator is provided versus when it is nil, which could be confusing. Consider using a consistent emoji in both cases.
| terminator == nil ? print("🖥️ [UI] \(text)") : print("⚪ [UI] \(text)", terminator: terminator!) | |
| terminator == nil ? print("🖥️ [UI] \(text)") : print("🖥️ [UI] \(text)", terminator: terminator!) |
| /// ``` | ||
| @inlinable public func logNetwork(_ text: String, terminator: String? = nil) { | ||
| #if DEBUG | ||
| terminator == nil ? print("🌎 [NETWORK] \(text)") : print("🛎️ [NETWORK] \(text)", terminator: terminator!) |
There was a problem hiding this comment.
In logNetwork, the usage of different emojis for the two branches may cause inconsistency in log output. Use a consistent icon for both cases to ensure clarity.
| terminator == nil ? print("🌎 [NETWORK] \(text)") : print("🛎️ [NETWORK] \(text)", terminator: terminator!) | |
| terminator == nil ? print("🌎 [NETWORK] \(text)") : print("🌎 [NETWORK] \(text)", terminator: terminator!) |
| /// ``` | ||
| var trim: String { | ||
| let charSet = CharacterSet.whitespacesAndNewlines | ||
| return String(format: "%@", trimmingCharacters(in: charSet)) |
There was a problem hiding this comment.
The implementation of the 'trim' property uses String(format:) with trimmingCharacters(in:) incorrectly. It should be updated to directly call 'self.trimmingCharacters(in: charSet)' to properly trim the string.
| return String(format: "%@", trimmingCharacters(in: charSet)) | |
| return self.trimmingCharacters(in: charSet) |
This PR addresses the documentation enhancement request by adding comprehensive Apple-style documentation throughout the OversizeCore library, making it fully compatible with DocC and significantly improving the developer experience.
📚 What's Changed
README.md Complete Overhaul
Core Library Documentation
Added comprehensive Apple-style documentation to all public APIs across 10+ Swift files:
Global Utilities
Swift Extensions
UI Extensions
🎯 Documentation Standards Applied
✅ Apple's Documentation Style Guide
///) for all public APIs- Parameter name: description- Returns: description✅ DocC Compatibility
✅ Developer Experience
📖 Example Documentation
🔧 Code Organization
MARK:comments for better navigation📱 Platform Support
All documentation includes platform-specific availability:
🎉 Impact
This update transforms OversizeCore from a minimally documented utility library into a professionally documented Swift package that:
The library now provides the same high-quality documentation experience as Apple's own frameworks and popular open-source Swift packages.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.