SwiftKotlin
SwiftKotlin copied to clipboard
Guard with more than one let
Swift:
guard array.count > row,
let a = CustomView.viewFor(item: array1[column].array[row]),
let b = something(a) else {
return UIView()
}
...
Tool Return:
val a = CustomView.viewFor(item = array1[column].array[row])
val b = somethin(a)
if (array.size <= row || playerView == null || b == null) {
return UIView()
}
...
Correct return:
if (array.size <= row) return UIView()
val a = CustomView.viewFor(item = array1[column].array[row]) ?: return UIView()
val b = somethin(a) ?: return UIView()
...