a switch bug in swift? - “Switch must be exhaustive, consider adding a default clause.”

前端 未结 3 843
青春惊慌失措
青春惊慌失措 2020-12-21 04:11

I am positive that the following swift code has covered all possibilities, but Xcode keeps telling me that, \"Switch must be exhaustive, consider ad

3条回答
  •  执笔经年
    2020-12-21 05:02

    If you calculate all the possible combinations between three elements with two possible values, the cases are more than four. If you don't care about the others, put a default case in your switch

提交回复
热议问题