|
8 | 8 |
|
9 | 9 | #if OPENSWIFTUI_TARGET_OS_DARWIN |
10 | 10 |
|
11 | | -// Modified based on macOS 15.5 SDK |
| 11 | +// Modified based on iOS 18.5 SDK |
12 | 12 |
|
13 | | -/* |
14 | | - NSParagraphStyle.h |
15 | | - Copyright (c) 1994-2024, Apple Inc. All rights reserved. |
16 | | -
|
17 | | - NSParagraphStyle and NSMutableParagraphStyle hold paragraph style information |
18 | | - NSTextTab holds information about a single tab stop |
19 | | - */ |
| 13 | +// NSParagraphStyle.h |
| 14 | +// UIKit |
| 15 | +// |
| 16 | +// Copyright (c) 2011-2024, Apple Inc. All rights reserved. |
| 17 | +// |
| 18 | +// NSParagraphStyle and NSMutableParagraphStyle hold paragraph style information |
| 19 | +// NSTextTab holds information about a single tab stop |
20 | 20 |
|
21 | 21 | #import <Foundation/Foundation.h> |
22 | 22 | #import "NSText.h" |
@@ -64,76 +64,76 @@ OPENSWIFTUI_EXPORT API_AVAILABLE(macos(10.0), ios(7.0), tvos(9.0), watchos(2.0), |
64 | 64 |
|
65 | 65 | + (NSCharacterSet *)columnTerminatorsForLocale:(nullable NSLocale *)aLocale API_AVAILABLE(macos(10.11), ios(7.0), tvos(9.0), watchos(2.0), visionos(1.0)); // Returns the column terminators for locale. Passing nil returns an instance corresponding to +[NSLocale systemLocale]. For matching user's formatting preferences, pass +[NSLocale currentLocale]. Can be used as the value for NSTabColumnTerminatorsAttributeName to make a decimal tab stop. |
66 | 66 |
|
67 | | -@property (readonly) CGFloat location; // Location of the tab stop inside the line fragment rect coordinate system |
68 | | -@property (readonly) NSDictionary<NSTextTabOptionKey, id> *options; // Optional configuration attributes |
| 67 | +@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat location; // Location of the tab stop inside the line fragment rect coordinate system |
| 68 | +@property (readonly, NS_NONATOMIC_IOSONLY) NSDictionary<NSTextTabOptionKey, id> *options; // Optional configuration attributes |
69 | 69 | @end |
70 | 70 |
|
71 | 71 |
|
72 | 72 | // NSParagraphStyle |
73 | 73 | OPENSWIFTUI_EXPORT API_AVAILABLE(macos(10.0), ios(6.0), tvos(9.0), watchos(2.0), visionos(1.0)) |
74 | 74 | @interface NSParagraphStyle : NSObject <NSCopying, NSMutableCopying, NSSecureCoding> |
75 | 75 |
|
76 | | -@property (class, readonly, copy) NSParagraphStyle *defaultParagraphStyle; // This class property returns a shared and cached NSParagraphStyle instance with the default style settings, with same value as the result of [[NSParagraphStyle alloc] init]. |
| 76 | +@property (class, readonly, copy, NS_NONATOMIC_IOSONLY) NSParagraphStyle *defaultParagraphStyle; // This class property returns a shared and cached NSParagraphStyle instance with the default style settings, with same value as the result of [[NSParagraphStyle alloc] init]. |
77 | 77 |
|
78 | 78 | + (NSWritingDirection)defaultWritingDirectionForLanguage:(nullable NSString *)languageName; // languageName is in ISO lang region format |
79 | 79 |
|
80 | | -@property (readonly) CGFloat lineSpacing; // "Leading": distance between the bottom of one line fragment and top of next (applied between lines in the same container). This value is included in the line fragment heights in layout manager. |
81 | | -@property (readonly) CGFloat paragraphSpacing; // Distance between the bottom of this paragraph and top of next (or the beginning of its paragraphSpacingBefore, if any). |
| 80 | +@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat lineSpacing; // "Leading": distance between the bottom of one line fragment and top of next (applied between lines in the same container). This value is included in the line fragment heights in layout manager. |
| 81 | +@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat paragraphSpacing; // Distance between the bottom of this paragraph and top of next (or the beginning of its paragraphSpacingBefore, if any). |
82 | 82 |
|
83 | 83 | // The following values are relative to the appropriate margin (depending on the paragraph direction) |
84 | 84 |
|
85 | | -@property (readonly) CGFloat headIndent; // Distance from margin to front edge of paragraph |
86 | | -@property (readonly) CGFloat tailIndent; // Distance from margin to back edge of paragraph; if negative or 0, from other margin |
87 | | -@property (readonly) CGFloat firstLineHeadIndent; // Distance from margin to edge appropriate for text direction |
| 85 | +@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat headIndent; // Distance from margin to front edge of paragraph |
| 86 | +@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat tailIndent; // Distance from margin to back edge of paragraph; if negative or 0, from other margin |
| 87 | +@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat firstLineHeadIndent; // Distance from margin to edge appropriate for text direction |
88 | 88 |
|
89 | | -@property (readonly) CGFloat minimumLineHeight; // Line height is the distance from bottom of descenders to top of ascenders; basically the line fragment height. Does not include lineSpacing (which is added after this computation). |
90 | | -@property (readonly) CGFloat maximumLineHeight; // 0 implies no maximum. |
| 89 | +@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat minimumLineHeight; // Line height is the distance from bottom of descenders to top of ascenders; basically the line fragment height. Does not include lineSpacing (which is added after this computation). |
| 90 | +@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat maximumLineHeight; // 0 implies no maximum. |
91 | 91 |
|
92 | | -@property (readonly) NSLineBreakMode lineBreakMode; |
| 92 | +@property (readonly, NS_NONATOMIC_IOSONLY) NSLineBreakMode lineBreakMode; |
93 | 93 |
|
94 | | -@property (readonly) NSWritingDirection baseWritingDirection; |
| 94 | +@property (readonly, NS_NONATOMIC_IOSONLY) NSWritingDirection baseWritingDirection; |
95 | 95 |
|
96 | | -@property (readonly) CGFloat lineHeightMultiple; // Natural line height is multiplied by this factor (if positive) before being constrained by minimum and maximum line height. |
97 | | -@property (readonly) CGFloat paragraphSpacingBefore; // Distance between the bottom of the previous paragraph (or the end of its paragraphSpacing, if any) and the top of this paragraph. |
| 96 | +@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat lineHeightMultiple; // Natural line height is multiplied by this factor (if positive) before being constrained by minimum and maximum line height. |
| 97 | +@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat paragraphSpacingBefore; // Distance between the bottom of the previous paragraph (or the end of its paragraphSpacing, if any) and the top of this paragraph. |
98 | 98 |
|
99 | 99 | // Specifies the threshold for hyphenation. Valid values lie between 0.0 and 1.0 inclusive. Hyphenation will be attempted when the ratio of the text width as broken without hyphenation to the width of the line fragment is less than the hyphenation factor. When this takes on its default value of 0.0, the layout manager's hyphenation factor is used instead. When both are 0.0, hyphenation is disabled. |
100 | | -@property (readonly) float hyphenationFactor; |
| 100 | +@property (readonly, NS_NONATOMIC_IOSONLY) float hyphenationFactor; |
101 | 101 |
|
102 | 102 | // A property controlling the hyphenation behavior for the paragraph associated with the paragraph style. The exact hyphenation logic is dynamically determined by the layout context such as language, platform, etc. When YES, it affects the return value from -hyphenationFactor when the property is set to 0.0. |
103 | | -@property (readonly) BOOL usesDefaultHyphenation API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0), visionos(1.0)); |
| 103 | +@property (readonly, NS_NONATOMIC_IOSONLY) BOOL usesDefaultHyphenation API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0), visionos(1.0)); |
104 | 104 |
|
105 | | -@property (readonly,copy) NSArray<NSTextTab *> *tabStops API_AVAILABLE(macos(10.0), ios(7.0), tvos(9.0), watchos(2.0), visionos(1.0)); // An array of NSTextTabs. Contents should be ordered by location. The default value is an array of 12 left-aligned tabs at 28pt interval |
106 | | -@property (readonly) CGFloat defaultTabInterval API_AVAILABLE(macos(10.0), ios(7.0), tvos(9.0), watchos(2.0), visionos(1.0)); // The default tab interval used for locations beyond the last element in tabStops |
| 105 | +@property (readonly,copy, NS_NONATOMIC_IOSONLY) NSArray<NSTextTab *> *tabStops API_AVAILABLE(macos(10.0), ios(7.0), tvos(9.0), watchos(2.0), visionos(1.0)); // An array of NSTextTabs. Contents should be ordered by location. The default value is an array of 12 left-aligned tabs at 28pt interval |
| 106 | +@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat defaultTabInterval API_AVAILABLE(macos(10.0), ios(7.0), tvos(9.0), watchos(2.0), visionos(1.0)); // The default tab interval used for locations beyond the last element in tabStops |
107 | 107 |
|
108 | | -@property (readonly, copy) NSArray<NSTextList *> *textLists API_AVAILABLE(macos(10.0), ios(7.0), tvos(9.0), watchos(2.0), visionos(1.0)); // Array to specify the text lists containing the paragraph, nested from outermost to innermost. |
| 108 | +@property (readonly, copy, NS_NONATOMIC_IOSONLY) NSArray<NSTextList *> *textLists API_AVAILABLE(macos(10.0), ios(7.0), tvos(9.0), watchos(2.0), visionos(1.0)); // Array to specify the text lists containing the paragraph, nested from outermost to innermost. |
109 | 109 |
|
110 | | -@property (readonly) BOOL allowsDefaultTighteningForTruncation API_AVAILABLE(macos(10.11), ios(9.0), tvos(9.0), watchos(2.0), visionos(1.0)); // Tightens inter-character spacing in attempt to fit lines wider than the available space if the line break mode is one of the truncation modes before starting to truncate. NO by default. The maximum amount of tightening performed is determined by the system based on contexts such as font, line width, etc. |
| 110 | +@property (readonly, NS_NONATOMIC_IOSONLY) BOOL allowsDefaultTighteningForTruncation API_AVAILABLE(macos(10.11), ios(9.0), tvos(9.0), watchos(2.0), visionos(1.0)); // Tightens inter-character spacing in attempt to fit lines wider than the available space if the line break mode is one of the truncation modes before starting to truncate. NO by default. The maximum amount of tightening performed is determined by the system based on contexts such as font, line width, etc. |
111 | 111 |
|
112 | | -@property (readonly) NSLineBreakStrategy lineBreakStrategy API_AVAILABLE(macos(10.11), ios(9.0), tvos(9.0), watchos(2.0), visionos(1.0)); // Specifies the line break strategies that may be used for laying out the paragraph. The default value is NSLineBreakStrategyNone. |
| 112 | +@property (readonly, NS_NONATOMIC_IOSONLY) NSLineBreakStrategy lineBreakStrategy API_AVAILABLE(macos(10.11), ios(9.0), tvos(9.0), watchos(2.0), visionos(1.0)); // Specifies the line break strategies that may be used for laying out the paragraph. The default value is NSLineBreakStrategyNone. |
113 | 113 |
|
114 | 114 | @end |
115 | 115 |
|
116 | 116 |
|
117 | 117 | OPENSWIFTUI_EXPORT API_AVAILABLE(macos(10.0), ios(6.0), tvos(9.0), watchos(2.0), visionos(1.0)) |
118 | 118 | @interface NSMutableParagraphStyle : NSParagraphStyle |
119 | 119 |
|
120 | | -@property CGFloat lineSpacing; |
121 | | -@property CGFloat paragraphSpacing; |
122 | | -@property CGFloat firstLineHeadIndent; |
123 | | -@property CGFloat headIndent; |
124 | | -@property CGFloat tailIndent; |
125 | | -@property NSLineBreakMode lineBreakMode; |
126 | | -@property CGFloat minimumLineHeight; |
127 | | -@property CGFloat maximumLineHeight; |
128 | | -@property NSWritingDirection baseWritingDirection; |
129 | | -@property CGFloat lineHeightMultiple; |
130 | | -@property CGFloat paragraphSpacingBefore; |
131 | | -@property float hyphenationFactor; |
132 | | -@property (readwrite) BOOL usesDefaultHyphenation API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0), visionos(1.0)); |
133 | | -@property (null_resettable, copy) NSArray<NSTextTab *> *tabStops API_AVAILABLE(macos(10.0), ios(7.0), tvos(9.0), watchos(2.0), visionos(1.0)); |
134 | | -@property CGFloat defaultTabInterval API_AVAILABLE(macos(10.0), ios(7.0), tvos(9.0), watchos(2.0), visionos(1.0)); |
135 | | -@property BOOL allowsDefaultTighteningForTruncation API_AVAILABLE(macos(10.11), ios(9.0), tvos(9.0), watchos(2.0), visionos(1.0)); |
136 | | -@property NSLineBreakStrategy lineBreakStrategy API_AVAILABLE(macos(10.11), ios(9.0), tvos(9.0), watchos(2.0), visionos(1.0)); |
| 120 | +@property (NS_NONATOMIC_IOSONLY) CGFloat lineSpacing; |
| 121 | +@property (NS_NONATOMIC_IOSONLY) CGFloat paragraphSpacing; |
| 122 | +@property (NS_NONATOMIC_IOSONLY) CGFloat firstLineHeadIndent; |
| 123 | +@property (NS_NONATOMIC_IOSONLY) CGFloat headIndent; |
| 124 | +@property (NS_NONATOMIC_IOSONLY) CGFloat tailIndent; |
| 125 | +@property (NS_NONATOMIC_IOSONLY) NSLineBreakMode lineBreakMode; |
| 126 | +@property (NS_NONATOMIC_IOSONLY) CGFloat minimumLineHeight; |
| 127 | +@property (NS_NONATOMIC_IOSONLY) CGFloat maximumLineHeight; |
| 128 | +@property (NS_NONATOMIC_IOSONLY) NSWritingDirection baseWritingDirection; |
| 129 | +@property (NS_NONATOMIC_IOSONLY) CGFloat lineHeightMultiple; |
| 130 | +@property (NS_NONATOMIC_IOSONLY) CGFloat paragraphSpacingBefore; |
| 131 | +@property (NS_NONATOMIC_IOSONLY) float hyphenationFactor; |
| 132 | +@property (readwrite, NS_NONATOMIC_IOSONLY) BOOL usesDefaultHyphenation API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0), visionos(1.0)); |
| 133 | +@property (null_resettable, copy, NS_NONATOMIC_IOSONLY) NSArray<NSTextTab *> *tabStops API_AVAILABLE(macos(10.0), ios(7.0), tvos(9.0), watchos(2.0), visionos(1.0)); |
| 134 | +@property (NS_NONATOMIC_IOSONLY) CGFloat defaultTabInterval API_AVAILABLE(macos(10.0), ios(7.0), tvos(9.0), watchos(2.0), visionos(1.0)); |
| 135 | +@property (NS_NONATOMIC_IOSONLY) BOOL allowsDefaultTighteningForTruncation API_AVAILABLE(macos(10.11), ios(9.0), tvos(9.0), watchos(2.0), visionos(1.0)); |
| 136 | +@property (NS_NONATOMIC_IOSONLY) NSLineBreakStrategy lineBreakStrategy API_AVAILABLE(macos(10.11), ios(9.0), tvos(9.0), watchos(2.0), visionos(1.0)); |
137 | 137 | @property (NS_NONATOMIC_IOSONLY, copy) NSArray<NSTextList *> *textLists API_AVAILABLE(macos(10.0), ios(7.0), tvos(9.0), watchos(2.0), visionos(1.0)); |
138 | 138 |
|
139 | 139 | - (void)addTabStop:(NSTextTab *)anObject API_AVAILABLE(macos(10.0), ios(9.0), tvos(9.0), watchos(2.0), visionos(1.0)); |
|
0 commit comments