@@ -52,9 +52,12 @@ extension ASAttributedString.Attribute {
52
52
case lineHeightMultiple // CGFloat
53
53
case paragraphSpacingBefore // CGFloat
54
54
case hyphenationFactor // Float
55
+ @available ( macOS 12 . 0 , iOS 15 . 0 , tvOS 15 . 0 , watchOSApplicationExtension 8 . 0 , * )
56
+ case usesDefaultHyphenation // Bool
55
57
case tabStops // [NSTextTab]
56
58
case defaultTabInterval // CGFloat
57
59
case allowsDefaultTighteningForTruncation // Bool
60
+ case lineBreakStrategy // NSParagraphStyle.LineBreakStrategy
58
61
}
59
62
60
63
fileprivate let style : [ Key : Any ]
@@ -82,9 +85,13 @@ extension ASAttributedString.Attribute {
82
85
fetch ( . lineHeightMultiple) { paragraph. lineHeightMultiple = $0 }
83
86
fetch ( . paragraphSpacingBefore) { paragraph. paragraphSpacingBefore = $0 }
84
87
fetch ( . hyphenationFactor) { paragraph. hyphenationFactor = $0 }
88
+ if #available( macOS 12 . 0 , iOS 15 . 0 , tvOS 15 . 0 , watchOSApplicationExtension 8 . 0 , * ) {
89
+ fetch ( . usesDefaultHyphenation) { paragraph. usesDefaultHyphenation = $0 }
90
+ }
85
91
fetch ( . tabStops) { paragraph. tabStops = $0 }
86
92
fetch ( . defaultTabInterval) { paragraph. defaultTabInterval = $0 }
87
93
fetch ( . allowsDefaultTighteningForTruncation) { paragraph. allowsDefaultTighteningForTruncation = $0 }
94
+ fetch ( . lineBreakStrategy) { paragraph. lineBreakStrategy = $0 }
88
95
return paragraph
89
96
}
90
97
}
@@ -144,6 +151,11 @@ extension ASAttributedString.Attribute.ParagraphStyle {
144
151
return . init( style: [ . hyphenationFactor: value] )
145
152
}
146
153
154
+ @available ( macOS 12 . 0 , iOS 15 . 0 , tvOS 15 . 0 , watchOSApplicationExtension 8 . 0 , * )
155
+ public static func usesDefaultHyphenation( _ value: Bool ) -> Self {
156
+ return . init( style: [ . usesDefaultHyphenation: value] )
157
+ }
158
+
147
159
public static func tabStops( _ value: [ NSTextTab ] ) -> Self {
148
160
return . init( style: [ . tabStops: value] )
149
161
}
@@ -155,6 +167,10 @@ extension ASAttributedString.Attribute.ParagraphStyle {
155
167
public static func allowsDefaultTighteningForTruncation( _ value: Bool ) -> Self {
156
168
return . init( style: [ . allowsDefaultTighteningForTruncation: value] )
157
169
}
170
+
171
+ public static func lineBreakStrategy( _ value: NSParagraphStyle . LineBreakStrategy ) -> Self {
172
+ return . init( style: [ . lineBreakStrategy: value] )
173
+ }
158
174
}
159
175
160
176
extension ASAttributedString . Attribute . ParagraphStyle {
0 commit comments