现在,我已经看到遍布stackoverflow的这个快速错误。但是,他们处理它的方式在我的情况下似乎不起作用。
if (
fieldType == "checkbox" ||
fieldType == "time" ||
fieldType == "birthdate" ||
fieldType == "datetime" ||
fieldType == "phone" ||
fieldType == "payment" ||
fieldType == "stripe" ||
fieldType == "paypal" ||
fieldType == "paypalpro" ||
fieldType == "address" ||
fieldType == "2co")
{
我不确定如何解决它。必须有某种方法来降低它的复杂性。
答案 0 :(得分:0)
我要做的只是从一系列文字开始:
let fieldType = "Howdy"
let possibilities = ["checkbox","time"] // ... add the others too...
if find(possibilities, fieldType) != nil { // or: if contains(possibilities,fieldType)
}