Slide 9
Slide 9 text
Binding処理を集約する
Bindingを1箇所で⾏いCCNが⾼い処理を集約
class A {
…
if let x = x, let y = y {
someSimpleFunc(x: x, y: x)
} else {
…
}
}
class B {
…
if let x = x, let y = y {
someSimpleFunc(x: x, y: x)
} else {
…
}
}
public func someSimpleFunc(
x: String, y: String
) -> String {…}
class A {
…
someComplexFunc(x: x, y: x)
}
class B {
…
someComplexFunc(x: x, y: x)
}
public func someComplexFunc(
x: String?, y: String?
) -> String {…}
呼び出し側でBinding
定義側でBinding