Refactor if/else in PollOptionRow
This commit is contained in:
parent
8217f5ce28
commit
b178c0cff9
|
@ -57,44 +57,32 @@ public struct PollOptionRow: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// beautiful!
|
switch (moveUp, moveDown, removeOption) {
|
||||||
if let moveUp {
|
case let (.some(up), .some(down), .some(remove)):
|
||||||
if let moveDown {
|
field
|
||||||
if let removeOption {
|
.accessibilityAction(named: L10n.Scene.Compose.Poll.moveUp, up)
|
||||||
field
|
.accessibilityAction(named: L10n.Scene.Compose.Poll.moveDown, down)
|
||||||
.accessibilityAction(named: L10n.Scene.Compose.Poll.moveUp, moveUp)
|
.accessibilityAction(named: L10n.Scene.Compose.Poll.removeOption, remove)
|
||||||
.accessibilityAction(named: L10n.Scene.Compose.Poll.moveDown, moveDown)
|
case let (.some(up), .some(down), .none):
|
||||||
.accessibilityAction(named: L10n.Scene.Compose.Poll.removeOption, removeOption)
|
field
|
||||||
} else {
|
.accessibilityAction(named: L10n.Scene.Compose.Poll.moveUp, up)
|
||||||
field
|
.accessibilityAction(named: L10n.Scene.Compose.Poll.moveDown, down)
|
||||||
.accessibilityAction(named: L10n.Scene.Compose.Poll.moveUp, moveUp)
|
case let (.some(up), .none, .some(remove)):
|
||||||
.accessibilityAction(named: L10n.Scene.Compose.Poll.moveDown, moveDown)
|
field
|
||||||
}
|
.accessibilityAction(named: L10n.Scene.Compose.Poll.moveUp, up)
|
||||||
} else {
|
.accessibilityAction(named: L10n.Scene.Compose.Poll.removeOption, remove)
|
||||||
if let removeOption {
|
case let (.some(up), .none, .none):
|
||||||
field
|
field.accessibilityAction(named: L10n.Scene.Compose.Poll.moveUp, up)
|
||||||
.accessibilityAction(named: L10n.Scene.Compose.Poll.moveUp, moveUp)
|
case let (.none, .some(down), .some(remove)):
|
||||||
.accessibilityAction(named: L10n.Scene.Compose.Poll.removeOption, removeOption)
|
field
|
||||||
} else {
|
.accessibilityAction(named: L10n.Scene.Compose.Poll.moveDown, down)
|
||||||
field.accessibilityAction(named: L10n.Scene.Compose.Poll.moveUp, moveUp)
|
.accessibilityAction(named: L10n.Scene.Compose.Poll.removeOption, remove)
|
||||||
}
|
case let (.none, .some(down), .none):
|
||||||
}
|
field.accessibilityAction(named: L10n.Scene.Compose.Poll.moveDown, down)
|
||||||
} else {
|
case let (.none, .none, .some(remove)):
|
||||||
if let moveDown {
|
field.accessibilityAction(named: L10n.Scene.Compose.Poll.removeOption, remove)
|
||||||
if let removeOption {
|
case (.none, .none, .none):
|
||||||
field
|
field
|
||||||
.accessibilityAction(named: L10n.Scene.Compose.Poll.moveDown, moveDown)
|
|
||||||
.accessibilityAction(named: L10n.Scene.Compose.Poll.removeOption, removeOption)
|
|
||||||
} else {
|
|
||||||
field.accessibilityAction(named: L10n.Scene.Compose.Poll.moveDown, moveDown)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if let removeOption {
|
|
||||||
field.accessibilityAction(named: L10n.Scene.Compose.Poll.removeOption, removeOption)
|
|
||||||
} else {
|
|
||||||
field
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue