Swift's guard keyword

前端 未结 13 2352
一整个雨季
一整个雨季 2020-11-27 09:03

Swift 2 introduced the guard keyword, which could be used to ensure that various data is configured ready to go. An example I saw on this website demonstrates a

13条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-27 10:04

    One benefit is elimination a lot of nested if let statements. See the WWDC "What's New in Swift" video around 15:30, the section titled "Pyramid of Doom".

提交回复
热议问题