Skip to content

Commit a9d2e7a

Browse files
committed
Adjust indent
1 parent 8897878 commit a9d2e7a

20 files changed

+176
-256
lines changed

RELEASE_NOTES.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ Until then, minor updates may remove deprecated features and introduce breaking
1010

1111
This version makes a first step towards removing library-specific types in favor of native types, to avoid having to add custom types and logic to the library, where native alternatives exist.
1212

13-
This version deprecates the `RichTextAlignment` type and instead
14-
15-
This version adds key path-based paragraph functions to the `RichTextViewComponent`. This means that you can now get and set the following values with a single set of functions, pickers, steppers and toggles:
13+
This version starts with `NSParagraphStyle` and its nested types, and makes it possible to get, set, pick, step and toggle the following values with a single set of functions, pickers, steppers and toggles:
1614

1715
`alignment`, `allowsDefaultTighteningForTruncation`, `baseWritingDirection`, `defaultTabInterval`, `firstLineHeadIndent`, `headIndent`, `hyphenationFactor`, `lineBreakMode`, `lineBreakStrategy`, `lineHeightMultiple`, `lineSpacing`, `maximumLineHeight`, `minimumLineHeight`, `paragraphSpacing`, `paragraphSpacingBefore`, `tabStops`, `tailIndent`, `usesDefaultHyphenation`.
1816

19-
As a result, all parts of the library that handled individual value types have been deprecated. This makes the library tighter, and a lot more capable with less code.
17+
As a result, this version deprecates the `RichTextAlignment` and `RichTextLine` type. This makes the library tighter, and a lot more capable with less code that does more.
2018

2119
### ✨ Features
2220

Sources/RichTextKit/Colors/ColorRepresentable.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,13 @@
99
#if macOS
1010
import AppKit
1111

12-
/**
13-
This typealias bridges platform-specific colors to simplify
14-
multi-platform support.
15-
*/
12+
/// This typealias bridges platform-specific colors.
1613
public typealias ColorRepresentable = NSColor
1714
#endif
1815

1916
#if iOS || os(tvOS) || os(watchOS) || os(visionOS)
2017
import UIKit
2118

22-
/**
23-
This typealias bridges platform-specific colors to simplify
24-
multi-platform support.
25-
*/
19+
/// This typealias bridges platform-specific colors.
2620
public typealias ColorRepresentable = UIColor
2721
#endif

Sources/RichTextKit/Colors/RichTextColor+Picker.swift

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,19 @@ import SwiftUI
1010

1111
public extension RichTextColor {
1212

13-
/**
14-
This picker can be used to select a rich text color.
15-
16-
This picker renders an icon next to the color picker as
17-
well as an optional list of quick colors.
18-
19-
The quick color list is empty by default. You can add a
20-
custom set of colors, for instance `.quickPickerColors`.
21-
*/
13+
/// This picker can be used to select a rich text color.
14+
///
15+
/// This picker renders an icon next to the color picker
16+
/// as well as an optional list of custom quick colors.
2217
struct Picker: View {
2318

24-
/**
25-
Create a rich text color picker that binds to a color.
26-
27-
- Parameters:
28-
- type: The type of color to pick.
29-
- icon: The icon to show, if any, by default the `type` icon.
30-
- value: The value to bind to.
31-
- quickColors: Colors to show in the trailing list, by default no colors.
32-
*/
19+
/// Create a rich text color picker.
20+
///
21+
/// - Parameters:
22+
/// - type: The type of color to pick.
23+
/// - icon: The icon to show, if any, by default the `type` icon.
24+
/// - value: The value to bind to.
25+
/// - quickColors: Colors to show in the trailing list, by default no colors.
3326
public init(
3427
type: RichTextColor,
3528
icon: Image? = nil,

Sources/RichTextKit/Colors/RichTextColor.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@
88

99
import SwiftUI
1010

11-
/**
12-
This enum defines supported rich text color types.
13-
14-
The enum makes the colors identifiable and diffable.
15-
*/
11+
/// This enum defines supported rich text color types.
1612
public enum RichTextColor: String, CaseIterable, Codable, Equatable, Identifiable {
1713

1814
/// Foreground color.

Sources/RichTextKit/Commands/RichTextCommand+ActionButton.swift

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,17 @@ import SwiftUI
1010

1111
public extension RichTextCommand {
1212

13-
/**
14-
This button can trigger any ``RichTextAction`` from the
15-
main menu.
16-
17-
This view requires that a ``RichTextContext`` is set as
18-
a focused value, otherwise it will be disabled.
19-
*/
13+
/// This button can trigger ``RichTextAction``s from the
14+
/// main menu.
15+
///
16+
/// This view requires that a ``RichTextContext`` is set
17+
/// as a focused value, otherwise it will be disabled.
2018
struct ActionButton: View {
2119

22-
/**
23-
Create a command button.
24-
25-
- Parameters:
26-
- action: The action to trigger.
27-
*/
20+
/// Create a command button.
21+
///
22+
/// - Parameters:
23+
/// - action: The action to trigger.
2824
public init(
2925
action: RichTextAction
3026
) {

Sources/RichTextKit/Commands/RichTextCommand+ActionButtonGroup.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ import SwiftUI
1010

1111
public extension RichTextCommand {
1212

13-
/**
14-
This view can add list of ``RichTextAction`` buttons to
15-
the main menu.
16-
17-
This view requires that a ``RichTextContext`` is set as
18-
a focused value, otherwise it will be disabled.
19-
*/
13+
/// This view can add list of ``RichTextAction`` buttons
14+
/// to the main menu.
15+
///
16+
/// This view requires that a ``RichTextContext`` is set
17+
/// as a focused value, otherwise it will be disabled.
2018
struct ActionButtonGroup: View {
2119

2220
/**

Sources/RichTextKit/Commands/RichTextCommand+FormatMenu.swift

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,13 @@ import SwiftUI
1111

1212
public extension RichTextCommand {
1313

14-
/**
15-
This menu adds standard rich text format options to the
16-
main menu, using `CommandGroup`.
17-
18-
You can apply this to a `WindowGroup` or `DocumentGroup`
19-
to make it appear in the app's main menu.
20-
21-
This menu requires that a ``RichTextContext`` is set as
22-
a focused value, otherwise it will be disabled.
23-
*/
14+
/// This menu adds format options to the main menu.
15+
///
16+
/// You can add it to a `WindowGroup` or `DocumentGroup`,
17+
/// to make it appear in the app's main menu.
18+
///
19+
/// This view requires that a ``RichTextContext`` is set
20+
/// as a focused value, otherwise it will be disabled.
2421
struct FormatMenu: Commands {
2522

2623
/// Create a rich text format command menu.

Sources/RichTextKit/Commands/RichTextCommand+ShareMenu.swift

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,26 @@ import SwiftUI
1111

1212
public extension RichTextCommand {
1313

14-
/**
15-
This menu view can add a list of sharing options to the
16-
main menu.
17-
18-
The menu will try to add options for share, export, and
19-
print, if applicable to the current platform. Selecting
20-
an option will trigger a corresponding, provided action.
21-
22-
The macOS exclusive `nsSharing` commands require you to
23-
return a share url, after which a command takes care of
24-
the sharing. Also note that the `formatNSSharingAction`
25-
and `pdfNSSharingAction` will only have effect on macOS,
26-
where they add ``RichTextNSSharingMenu`` options.
27-
28-
Note that a pdf action menu will only be included if it
29-
has a corresponding action. Also note that you must use
30-
`isEnabled: false` to disable the menu, since you can't
31-
add `.disabled` to the command menu.
32-
33-
Setting actions to `nil` removes the related menu items.
34-
*/
14+
/// This menu adds share options to the main menu.
15+
///
16+
/// This menu will attempt to add menu options for share,
17+
/// export, and print, if applicable to the platform.
18+
///
19+
/// The macOS exclusive `nsSharing` commands require you
20+
/// to return a share url, after which the command takes
21+
/// care of the sharing. The `formatNSSharingAction` and
22+
/// `pdfNSSharingAction` only works on macOS, where they
23+
/// add ``RichTextNSSharingMenu`` options.
24+
///
25+
/// Note that a pdf action menu will only be included if
26+
/// it has an action. You must use `isEnabled: false` to
27+
/// disable the menu, since you can't add `.disabled` to
28+
/// the command menu.
29+
///
30+
/// Setting an action to `nil` removes the related menu.
3531
struct ShareMenu: Commands {
3632

37-
/**
38-
Create a rich text share command menu.
39-
*/
33+
/// Create a rich text share command menu.
4034
public init(
4135
isEnabled: Bool = true,
4236
shareFormats: [RichTextDataFormat],

Sources/RichTextKit/Commands/RichTextCommand.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88

99
import Foundation
1010

11-
/**
12-
This type is used as a namespace for command-specific types,
13-
like command menus and buttons.
14-
15-
> Important: Most rich text commands require that there's a
16-
``RichTextContext`` set as a focused value.
17-
*/
11+
/// This is a namespace for command-specific types like menu
12+
/// and buttons commands.
13+
///
14+
/// > Important: The rich text-related commands require that
15+
/// there's a ``RichTextContext`` set as a focused value.
1816
public struct RichTextCommand {}

Sources/RichTextKit/Data/NSAttributedString+Init.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ import Foundation
1010

1111
public extension NSAttributedString {
1212

13-
/**
14-
Try to parse ``RichTextDataFormat`` formatted data.
15-
16-
- Parameters:
17-
- data: The data to initialize the string with.
18-
- format: The data format to use.
19-
*/
13+
/// Try to parse ``RichTextDataFormat`` formatted data.
14+
///
15+
/// - Parameters:
16+
/// - data: The data to initialize the string with.
17+
/// - format: The data format to use.
2018
convenience init(
2119
data: Data,
2220
format: RichTextDataFormat

0 commit comments

Comments
 (0)