Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
orchetect committed Oct 18, 2024
1 parent ca14e44 commit 3cb4cb0
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 26 deletions.
18 changes: 9 additions & 9 deletions Sources/TimecodeKit/Documentation.docc/Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Value types, AV methods and UI components for representing and working with SMPT

![TimecodeKit](timecodekit-banner.png)

For core types, math, and conversions see **TimecodeKitCore** documentation.
For core types, math, and conversions see <doc://TimecodeKit/TimecodeKitCore> documentation.

For AVFoundation methods, see **TimecodeKitAV** documentation.
For AVFoundation methods, see <doc://TimecodeKit/TimecodeKitAV> documentation.

For UI components, see **TimecodeKitUI** documentation.
For UI components, see <doc://TimecodeKit/TimecodeKitUI> documentation.

## Topics

Expand All @@ -17,13 +17,13 @@ For UI components, see **TimecodeKitUI** documentation.
- <doc:Getting-Started>
- <doc:TimecodeKit-2-Migration-Guide>

### Modules

- <doc:TimecodeKikCore>
- <doc:TimecodeKikCoreAV>
- <doc:TimecodeKikCoreUI>

### Formats Addendum

- <doc:LTC-Linear-Timecode>
- <doc:MTC-MIDI-Timecode>

### Modules

- <doc://TimecodeKit/TimecodeKitCore>
- <doc://TimecodeKit/TimecodeKitAV>
- <doc://TimecodeKit/TimecodeKitUI>
2 changes: 1 addition & 1 deletion Sources/TimecodeKit/Documentation.docc/Getting-Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import TimecodeKitUI

## Using TimecodeKit

The documentation page for ``TimecodeKitCore/Timecode`` provides a quick overview of how to form timecode and convert to/from various other time values.
The documentation page for <doc://TimecodeKit/TimecodeKitCore/Timecode-swift.struct> provides a quick overview of how to form timecode and convert to/from various other time values.

Example projects are located in the Examples folder to demonstrate usage of the library.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ MIDI Timecode is a device synchronization protocol that encodes SPMTE timecode u
TimecodeKit does not implement MTC encoding or decoding directly.

Instead, [MIDIKit](https://github.com/orchetect/MIDIKit) (an open-source Swift MIDI I/O package for all Apple platforms) implements MTC encoding/decoding.
It imports TimecodeKit as a dependency and uses ``TimecodeKitCore/Timecode`` and ``TimecodeKitCore/TimecodeFrameRate`` as data structures.
It imports TimecodeKit as a dependency and uses <doc://TimecodeKit/TimecodeKitCore/Timecode-swift.struct> and <doc://TimecodeKit/TimecodeKitCore/TimecodeFrameRate-swift.enum> as data structures.

## References

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ Timecode(.string("01:00:00:00"), at: .fps24, by: .allowingInvalid)

## Timecode String Value

- The `stringValue` property is now the ``TimecodeKitCore/Timecode/stringValue(format:)`` method.
- The Timecode struct no longer stores string formatting properties. Instead, formatting options are now optionally passed when calling ``TimecodeKitCore/Timecode/stringValue(format:)``.
- The `stringValue` property is now the <doc://TimecodeKit/TimecodeKitCore/Timecode/stringValue(format:)> method.
- The Timecode struct no longer stores string formatting properties. Instead, formatting options are now optionally passed when calling <doc://TimecodeKit/TimecodeKitCore/Timecode/stringValue(format:)>.

```swift
// 1.x API
Expand Down Expand Up @@ -106,7 +106,7 @@ let timecode = try Timecode(
)
```

Timecode metadata can now also be constructed and passed using a new ``TimecodeKitCore/Timecode/Properties-swift.struct`` struct. It contains:
Timecode metadata can now also be constructed and passed using a new <doc://TimecodeKit/TimecodeKitCore/Timecode/Properties-swift.struct> struct. It contains:

- `frameRate`
- `subFramesBase`
Expand Down Expand Up @@ -168,17 +168,17 @@ try "01:00:00:00".toTimecode(at: ._24)

Some enum cases have been renamed to conform to lowerCamelCase and replace underscore prefixes.

- ``TimecodeKitCore/TimecodeFrameRate`` cases have been renamed.
- <doc://TimecodeKit/TimecodeKitCore/TimecodeFrameRate> cases have been renamed.
- `._24` is now `.fps24` and so on
- ``TimecodeKitCore/VideoFrameRate`` cases have been renamed.
- <doc://TimecodeKit/TimecodeKitCore/VideoFrameRate> cases have been renamed.
- `._24p` is now `.fps24p` and so on
- ``TimecodeKitCore/Timecode/UpperLimit-swift.enum`` cases have been renamed.
- <doc://TimecodeKit/TimecodeKitCore/Timecode/UpperLimit-swift.enum> cases have been renamed.
- `._24hours` is now `.max24Hours`
- `._100days` is now `.max100Days`
- ``TimecodeKitCore/Timecode/SubFramesBase-swift.enum`` cases have been renamed.
- <doc://TimecodeKit/TimecodeKitCore/Timecode/SubFramesBase-swift.enum> cases have been renamed.
- `._80SubFrames` is now `.max80SubFrames`
- `._100SubFrames` is now `.max100SubFrames`
- ``TimecodeKitCore/TimecodeFrameRate/CompatibleGroup-swift.enum`` cases have been renamed.
- <doc://TimecodeKit/TimecodeKitCore/TimecodeFrameRate/CompatibleGroup-swift.enum> cases have been renamed.
- `.NTSC` is now `.ntscColor`
- `.NTSC_drop` is now `.ntscDrop`
- `.ATSC` is now `.whole`
Expand Down
40 changes: 40 additions & 0 deletions Sources/TimecodeKitCore/Documentation.docc/Timecode-Components.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ``TimecodeKitCore/Timecode/Components-swift.struct``

Primitive storage type for timecode component values.

## Topics

### Component Values

- ``days``
- ``hours``
- ``minutes``
- ``seconds``
- ``frames``
- ``subFrames``

### Initializer

- ``init(d:h:m:s:f:sf:)``

### Static Constructors

- ``zero``
- ``random(using:)``
- ``random(in:)``

### Array

- ``init(_:)-8i9vr``
- ``array``

### Dictionary

- ``init(_:)-7z48q``
- ``dictionary``

### Validation

- ``isWithinValidDigitCount(at:base:)``
- ``validRange(of:using:)``
- ``validRange(of:at:base:limit:)``
4 changes: 4 additions & 0 deletions Sources/TimecodeKitCore/Timecode/Source/Timecode Random.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@

extension Timecode {
/// Constrains component values to only valid values at the given frame rate, subframes base and upper limit.
@_documentation(visibility: internal)
public struct SafeRandomComponents {
init() { }
}

/// Randomize timecode components within the given ranges, allowing potential invalid values.
@_documentation(visibility: internal)
public struct UnsafeRandomComponents {
let ranges: Timecode.ComponentRanges

Expand All @@ -23,11 +25,13 @@ extension Timecode {

/// Randomizes timecode properties and generates random component values constrained to only valid values at the
/// generated frame rate, subframes base and upper limit.
@_documentation(visibility: internal)
public struct SafeRandomComponentsAndProperties {
init() { }
}

/// Randomizes timecode properties and generates random component values, allowing potential invalid values.
@_documentation(visibility: internal)
public struct UnsafeRandomComponentsAndProperties {
let ranges: Timecode.ComponentRanges

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//

/// A timecode transformer containing one or more transform rules in series.
/// See the <doc:Timecode-Transformer> topic for details.
public struct TimecodeTransformer {
public var transforms: [Transform]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ extension Timecode {

#endif

@_documentation(visibility: internal)
extension Timecode.TextFormatter {
@available(*, deprecated, renamed: "invalidAttributes")
public var validationAttributes: [NSAttributedString.Key: Any] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ extension NSAttributedString {
/// - Parameters:
/// - timecode: Timecode instance.
/// - format: String format options.
/// - defaultAttributes: The base attributes applied to the entire string before ``invalidAttributes`` are
/// - defaultAttributes: The base attributes applied to the entire string before `invalidAttributes` are
/// applied.
/// - invalidAttributes: The attributes applied to invalid values. This attribute overrides any
/// ``defaultAttributes``.
/// `defaultAttributes`.
public convenience init(
_ timecode: Timecode,
format: Timecode.StringFormat = .default(),
Expand Down Expand Up @@ -71,12 +71,11 @@ extension Timecode {
/// ```
///
/// - Parameters:
/// - timecode: Timecode instance.
/// - format: String format options.
/// - defaultAttributes: The base attributes applied to the entire string before ``invalidAttributes`` are
/// - defaultAttributes: The base attributes applied to the entire string before `invalidAttributes` are
/// applied.
/// - invalidAttributes: The attributes applied to invalid values. This attribute overrides any
/// ``defaultAttributes``.
/// `defaultAttributes`.
public func nsAttributedString(
format: StringFormat = .default(),
defaultAttributes: [NSAttributedString.Key: Any]?,
Expand Down
2 changes: 1 addition & 1 deletion Sources/TimecodeKitUI/Documentation.docc/Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ UI controls and tools for formatting and displaying timecode, including user-edi
### AttributedString

- ``Foundation/AttributedString/init(_:format:separatorStyle:validationStyle:)``
- ``TimecodeKitCore/Timecode/stringValueValidatedText(format:invalidModifiers:defaultModifiers:)``
- ``TimecodeKitCore/Timecode/nsAttributedString(format:defaultAttributes:invalidAttributes:)``

### Formatter

Expand Down

0 comments on commit 3cb4cb0

Please sign in to comment.