Skip to content

Commit 7bbec7e

Browse files
committed
Update documentation
1 parent cc2453d commit 7bbec7e

85 files changed

Lines changed: 732 additions & 1114 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.

Sources/RichTextKit/Actions/RichTextAction+Button.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ public extension RichTextAction {
1212

1313
/// This view can be used to trigger a ``RichTextAction``.
1414
///
15-
/// It renders a plain `Button`, which means you can use
16-
/// and configure it as a normal button.
15+
/// This view is rendered as a plain SwiftUI `Button`, so you can use and
16+
/// configure it just like a regular button.
1717
struct Button: View {
1818

1919
/// Create a rich text action button.

Sources/RichTextKit/Actions/RichTextAction+ButtonGroup.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public extension RichTextAction {
1313

1414
/// This view adds ``RichTextAction`` buttons to a group.
1515
///
16-
/// Since the view will bind to multiple values, it uses
17-
/// a ``RichTextContext`` instead of individual values.
16+
/// Since this view binds to multiple values, it uses a ``RichTextContext``
17+
/// instead of individual values.
1818
struct ButtonGroup: View {
1919

2020
/// Create a rich text action button stack.

Sources/RichTextKit/Actions/RichTextAction+ButtonStack.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ public extension RichTextAction {
1212

1313
/// This view adds ``RichTextAction`` buttons to a stack.
1414
///
15-
/// Since the view will bind to multiple values, it uses
16-
/// a ``RichTextContext`` instead of individual values.
15+
/// Since this view binds to multiple values, it uses a ``RichTextContext``
16+
/// instead of individual values.
1717
struct ButtonStack: View {
1818

1919
/// Create a rich text action button stack.

Sources/RichTextKit/Actions/RichTextAction+KeyboardShortcutModifier.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ import SwiftUI
1010

1111
public extension RichTextAction {
1212

13-
/// Apply keyboard shortcuts for a ``RichTextAction`` to
14-
/// the view.
13+
/// Apply keyboard shortcuts for a ``RichTextAction`` to the view.
1514
///
1615
/// You can also use ``SwiftUICore/View/keyboardShortcut(for:)-9i7js``.
1716
struct KeyboardShortcutModifier: ViewModifier {
@@ -30,8 +29,7 @@ public extension RichTextAction {
3029

3130
public extension View {
3231

33-
/// Apply keyboard shortcuts for a ``RichTextAction`` to
34-
/// the view.
32+
/// Apply keyboard shortcuts for a ``RichTextAction`` to the view.
3533
@ViewBuilder
3634
func keyboardShortcut(for action: RichTextAction) -> some View {
3735
#if iOS || macOS || os(visionOS)

Sources/RichTextKit/Actions/RichTextAction.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99
import SwiftUI
1010
import Combine
1111

12-
/// This enum defines rich text actions that can be executed
13-
/// on a rich text editor.
12+
/// This enum defines rich text actions that can be executed on a rich text editor.
1413
///
15-
/// It's also a namespace for action-related types and views,
16-
/// like ``RichTextAction/Button``.
14+
/// It's also a namespace for action-related types, like ``RichTextAction/Button``.
1715
public enum RichTextAction: Identifiable, Equatable, RichTextLabelValue {
1816

1917
/// Copy the currently selected text, if any.

Sources/RichTextKit/Actions/RichTextInsertion.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@
77

88
import Foundation
99

10-
/// This protocol can be implemented by anything that can be
11-
/// inserted into a rich text.
10+
/// This protocol can be implemented by types that can be inserted into a rich text.
1211
public protocol RichTextInsertable: Hashable, Equatable {}
1312

1413
extension String: RichTextInsertable {}
1514
extension ImageRepresentable: RichTextInsertable {}
1615
extension [ImageRepresentable]: RichTextInsertable {}
1716
extension NSAttributedString: RichTextInsertable {}
1817

19-
/// This struct represents something that should be inserted
20-
/// into a rich text attributed string.
18+
/// This struct represents something that should be inserted into a rich text.
2119
public struct RichTextInsertion<T: RichTextInsertable>: Hashable, Equatable {
2220

2321
/// Create a rich text insertion.

Sources/RichTextKit/Attributes/RichTextAttribute.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ import Foundation
1111
/// This typealias represents a rich text dictionary key.
1212
public typealias RichTextAttribute = NSAttributedString.Key
1313

14-
/// This typealias represents a dictionary with an attribute
15-
/// as key and `Any` as value.
14+
/// This typealias represents a dictionary with an attribute key and `Any` value.
1615
public typealias RichTextAttributes = [RichTextAttribute: Any]

Sources/RichTextKit/Attributes/RichTextAttributeReader.swift

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,15 @@
88

99
import Foundation
1010

11-
/// This protocol extends the ``RichTextReader`` protocol to
12-
/// make any implementing type able to get attributes in the
13-
/// ``RichTextReader/richText`` property.
11+
/// This protocol extends the ``RichTextReader`` protocol to make any type
12+
/// that implements it able to get ``RichTextReader/richText`` attributes.
1413
///
15-
/// This protocol is implemented by `NSAttributedString` and
16-
/// other types in the library.
14+
/// The protocol is implemented by `NSAttributedString` and other types in
15+
/// the library.
1716
///
18-
/// > Note: The protocol used to have a lot of functionality
19-
/// for getting various attributes, styles, etc. However, it
20-
/// caused duplicated code since the ``RichTextViewComponent``
21-
/// needed more capabilities as well. As such, this protocol
22-
/// is now limited in functionality.
17+
/// > Note: This protocol used to have a lot of functionality. This caused duplicated
18+
/// code since the ``RichTextViewComponent`` needed to do more. As such,
19+
/// this protocol is now limited in functionality.
2320
public protocol RichTextAttributeReader: RichTextReader {}
2421

2522
extension NSAttributedString: RichTextAttributeReader {}

Sources/RichTextKit/Attributes/RichTextAttributeWriter.swift

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,15 @@
88

99
import Foundation
1010

11-
/// This protocol extends the ``RichTextWriter`` protocol to
12-
/// make any implementing type able to set attributes in the
13-
/// ``RichTextReader/richText`` property.
11+
/// This protocol extends the ``RichTextWriter`` protocol to make any type
12+
/// that implements it able to set ``RichTextReader/richText`` attributes.
1413
///
15-
/// This protocol is implemented by `NSAttributedString` and
16-
/// other types in the library.
14+
/// This protocol is implemented by `NSAttributedString` and other types in
15+
/// the library.
1716
///
18-
/// > Note: The protocol used to have a lot of functionality
19-
/// for getting various attributes, styles, etc. However, it
20-
/// caused duplicated code since the ``RichTextViewComponent``
21-
/// needed more capabilities as well. As such, this protocol
22-
/// is now limited in functionality.
17+
/// > Note: This protocol used to have a lot of functionality. This caused duplicated
18+
/// code since the ``RichTextViewComponent`` needed to do more. As such,
19+
/// this protocol is now limited in functionality.
2320
public protocol RichTextAttributeWriter: RichTextWriter, RichTextAttributeReader {}
2421

2522
extension NSMutableAttributedString: RichTextAttributeWriter {}

Sources/RichTextKit/Bridging/RichTextViewComponent+Font.swift

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,18 @@
66
// Copyright © 2022-2024 Daniel Saidi. All rights reserved.
77
//
88

9-
/// These functions may seem complicated, but it is the only
10-
/// way that seems to work correctly, so far.
9+
/// These functions may seem complicated, but it's the only way that work, so far.
1110
///
12-
/// I previously grabbed the `typingAttributes` and took the
13-
/// `.font` attribute from it, then took its `fontDescriptor`
14-
/// and created a new font with `withFamily`, then created a
15-
/// new font with the new descriptor and old size.
11+
/// I previously grabbed the `typingAttributes` and its `.font` attribute,
12+
/// then used its `fontDescriptor` to create a new font with `withFamily`,
13+
/// then created a new font with the new descriptor and old size.
1614
///
17-
/// That approach however fails since the San Francisco font
18-
/// specifies a certain usage, that casuses the font name to
19-
/// not apply. This code just creates a new font instead, so
20-
/// be aware if something doesn't work as expected.
15+
/// That approach however fails since the San Francisco font specifies a certain
16+
/// usage, that casuses the font name to not apply. This code creates a new font
17+
/// instead, so be aware if something doesn't work as expected.
2118
///
22-
/// After removing the ``RichTextAttributeWriter`` in 1.0 we
23-
/// can hopefully iterate more consistently on the extension.
19+
/// After removing the ``RichTextAttributeWriter`` in 1.0 we can iterate
20+
/// more consistently on the extension.
2421

2522
import CoreGraphics
2623
import Foundation

0 commit comments

Comments
 (0)