Easiest way to force a crash in Swift

后端 未结 6 919

What is the easiest way to force a crash in Swift?

I would like to use only one line of code (something that I can add quickly).

I don\'t want to use breakp

6条回答
  •  清酒与你
    2020-12-24 14:01

    You can simply try to access an optional value that has nil value... if you already have a variable declared and it is an optional, just call it (don't forget to unwrap) and it will crash for sure

提交回复
热议问题