Swift error: guard body must not fall through

The guard statement needs to have a something to take the flow of the program away from the enclosing scope (e.g. most likely case is return to return from the function). This is required as the condition that guard is guarding will not be valid, so the program flow needs to go elsewhere!

Documentation:

The else clause of a guard statement is required, and must either call a function with the Never return type or transfer program control outside the guard statement’s enclosing scope using one of the following statements:

  • return
  • break
  • continue
  • throw

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)