@@ -268,15 +268,19 @@ extension TextState {
268268 return `self`
269269 }
270270
271- public func accessibilityLabel< S: StringProtocol > ( _ string: S ) -> Self {
271+ public func accessibilityLabel< S: StringProtocol > ( _ string: S ) -> Self {
272272 var `self` = self
273273 `self`. modifiers. append ( . accessibilityLabel( . init( string) ) )
274274 return `self`
275275 }
276276
277- public func accessibilityLabel( _ key: LocalizedStringKey , tableName: String ? = nil , bundle: Bundle ? = nil , comment: StaticString ? = nil ) -> Self {
277+ public func accessibilityLabel(
278+ _ key: LocalizedStringKey , tableName: String ? = nil , bundle: Bundle ? = nil ,
279+ comment: StaticString ? = nil
280+ ) -> Self {
278281 var `self` = self
279- `self`. modifiers. append ( . accessibilityLabel( . init( key, tableName: tableName, bundle: bundle, comment: comment) ) )
282+ `self`. modifiers. append (
283+ . accessibilityLabel( . init( key, tableName: tableName, bundle: bundle, comment: comment) ) )
280284 return `self`
281285 }
282286
@@ -301,37 +305,38 @@ extension Text {
301305 self = state. modifiers. reduce ( text) { text, modifier in
302306 switch modifier {
303307 #if compiler(>=5.5.1)
304- case let . accessibilityHeading( level) :
305- if #available( iOS 15 . 0 , macOS 12 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * ) {
306- return text. accessibilityHeading ( level. toSwiftUI)
307- } else {
308- return text
309- }
310- case let . accessibilityLabel( value) :
311- if #available( iOS 15 . 0 , macOS 12 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * ) {
312- switch value. storage {
313- case let . verbatim( string) :
314- return text. accessibilityLabel ( string)
315- case let . localized( key, tableName, bundle, comment) :
316- return text. accessibilityLabel ( Text ( key, tableName: tableName, bundle: bundle, comment: comment) )
317- case . concatenated( _, _) :
318- assertionFailure ( " `.accessibilityLabel` does not support contcatenated `TextState` " )
308+ case let . accessibilityHeading( level) :
309+ if #available( iOS 15 . 0 , macOS 12 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * ) {
310+ return text. accessibilityHeading ( level. toSwiftUI)
311+ } else {
312+ return text
313+ }
314+ case let . accessibilityLabel( value) :
315+ if #available( iOS 15 . 0 , macOS 12 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * ) {
316+ switch value. storage {
317+ case let . verbatim( string) :
318+ return text. accessibilityLabel ( string)
319+ case let . localized( key, tableName, bundle, comment) :
320+ return text. accessibilityLabel (
321+ Text ( key, tableName: tableName, bundle: bundle, comment: comment) )
322+ case . concatenated( _, _) :
323+ assertionFailure ( " `.accessibilityLabel` does not support contcatenated `TextState` " )
324+ return text
325+ }
326+ } else {
327+ return text
328+ }
329+ case let . accessibilityTextContentType( type) :
330+ if #available( iOS 15 . 0 , macOS 12 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * ) {
331+ return text. accessibilityTextContentType ( type. toSwiftUI)
332+ } else {
319333 return text
320334 }
321- } else {
322- return text
323- }
324- case let . accessibilityTextContentType( type) :
325- if #available( iOS 15 . 0 , macOS 12 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * ) {
326- return text. accessibilityTextContentType ( type. toSwiftUI)
327- } else {
328- return text
329- }
330335 #else
331- case . accessibilityHeading,
336+ case . accessibilityHeading,
332337 . accessibilityLabel,
333338 . accessibilityTextContentType:
334- return text
339+ return text
335340 #endif
336341 case let . baselineOffset( baselineOffset) :
337342 return text. baselineOffset ( baselineOffset)
0 commit comments