chore(linter/swift): add shorthand_optional_binding rule (#3456)

* chore(linter/swift): add `shorthand_optional_binding` rule

* lint code
This commit is contained in:
Krzysztof Moch
2024-01-04 20:16:23 +01:00
committed by GitHub
parent 481cc71eda
commit 2ed3949307
10 changed files with 56 additions and 55 deletions

View File

@@ -159,12 +159,12 @@ enum RCTPlayerOperations {
mediaOption = group.options[index]
}
}
} else if let group = group { // default. invalid type or "system"
} else if let group { // default. invalid type or "system"
player?.currentItem?.selectMediaOptionAutomatically(in: group)
return
}
if let group = group {
if let group {
// If a match isn't found, option will be nil and text tracks will be disabled
player?.currentItem?.select(mediaOption, in: group)
}
@@ -206,7 +206,7 @@ enum RCTPlayerOperations {
options = .duckOthers
}
if let category = category, let options = options {
if let category, let options {
do {
try audioSession.setCategory(category, options: options)
} catch {
@@ -229,13 +229,13 @@ enum RCTPlayerOperations {
}
#endif
}
} else if let category = category, options == nil {
} else if let category, options == nil {
do {
try audioSession.setCategory(category)
} catch {
debugPrint("[RCTPlayerOperations] Problem setting up AVAudioSession category. Error: \(error).")
}
} else if category == nil, let options = options {
} else if category == nil, let options {
do {
try audioSession.setCategory(audioSession.category, options: options)
} catch {