Skip to content

Commit 5307c31

Browse files
committed
Fix iOS header issue
1 parent efcd83d commit 5307c31

File tree

2 files changed

+55
-51
lines changed

2 files changed

+55
-51
lines changed

Sources/OpenSwiftUI_SPI/Shims/UIFoundation/NSParagraphStyle.h

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

99
#if OPENSWIFTUI_TARGET_OS_DARWIN
1010

11-
// Modified based on macOS 15.5 SDK
11+
// Modified based on iOS 18.5 SDK
1212

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
2020

2121
#import <Foundation/Foundation.h>
2222
#import "NSText.h"
@@ -64,76 +64,76 @@ OPENSWIFTUI_EXPORT API_AVAILABLE(macos(10.0), ios(7.0), tvos(9.0), watchos(2.0),
6464

6565
+ (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.
6666

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
6969
@end
7070

7171

7272
// NSParagraphStyle
7373
OPENSWIFTUI_EXPORT API_AVAILABLE(macos(10.0), ios(6.0), tvos(9.0), watchos(2.0), visionos(1.0))
7474
@interface NSParagraphStyle : NSObject <NSCopying, NSMutableCopying, NSSecureCoding>
7575

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].
7777

7878
+ (NSWritingDirection)defaultWritingDirectionForLanguage:(nullable NSString *)languageName; // languageName is in ISO lang region format
7979

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).
8282

8383
// The following values are relative to the appropriate margin (depending on the paragraph direction)
8484

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
8888

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.
9191

92-
@property (readonly) NSLineBreakMode lineBreakMode;
92+
@property (readonly, NS_NONATOMIC_IOSONLY) NSLineBreakMode lineBreakMode;
9393

94-
@property (readonly) NSWritingDirection baseWritingDirection;
94+
@property (readonly, NS_NONATOMIC_IOSONLY) NSWritingDirection baseWritingDirection;
9595

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.
9898

9999
// 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;
101101

102102
// 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));
104104

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
107107

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.
109109

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.
111111

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.
113113

114114
@end
115115

116116

117117
OPENSWIFTUI_EXPORT API_AVAILABLE(macos(10.0), ios(6.0), tvos(9.0), watchos(2.0), visionos(1.0))
118118
@interface NSMutableParagraphStyle : NSParagraphStyle
119119

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));
137137
@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));
138138

139139
- (void)addTabStop:(NSTextTab *)anObject API_AVAILABLE(macos(10.0), ios(9.0), tvos(9.0), watchos(2.0), visionos(1.0));

Sources/OpenSwiftUI_SPI/Shims/UIFoundation/NSStringDrawing.h

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

99
#if OPENSWIFTUI_TARGET_OS_DARWIN
1010

11-
// Modified based on macOS 15.5 SDK
11+
// Modified based on iOS 18.5 SDK
1212

13-
/*
14-
NSStringDrawing.h
15-
Copyright (c) 1994-2024, Apple Inc. All rights reserved.
16-
*/
13+
//
14+
// NSStringDrawing.h
15+
// UIKit
16+
//
17+
// Copyright (c) 2011-2024, Apple Inc. All rights reserved.
18+
//
1719

1820
#import <Foundation/Foundation.h>
1921
@class NSAttributedString;
@@ -55,8 +57,10 @@ typedef NS_OPTIONS(NSInteger, NSStringDrawingOptions) {
5557
NSStringDrawingUsesFontLeading = 1 << 1, // Uses the font leading for calculating line heights
5658
NSStringDrawingUsesDeviceMetrics = 1 << 3, // Uses image glyph bounds instead of typographic bounds
5759
NSStringDrawingTruncatesLastVisibleLine API_AVAILABLE(macos(10.5), ios(6.0), tvos(9.0), watchos(2.0), visionos(1.0)) = 1 << 5, // Truncates and adds the ellipsis character to the last visible line if the text doesn't fit into the bounds specified. Ignored if NSStringDrawingUsesLineFragmentOrigin is not also set.
60+
#if OPENSWIFTUI_TARGET_OS_OSX
5861
NSStringDrawingDisableScreenFontSubstitution API_DEPRECATED("", macos(10.0,10.11)) = (1 << 2),
5962
NSStringDrawingOneShot API_DEPRECATED("", macos(10.0,10.11)) = (1 << 4),
63+
#endif
6064
}
6165
NS_SWIFT_NAME(NSString.DrawingOptions)
6266
API_AVAILABLE(macos(10.0), ios(6.0), tvos(9.0), watchos(2.0), visionos(1.0));

0 commit comments

Comments
 (0)