unwrapping multiple optionals in if statement

前端 未结 8 617
鱼传尺愫
鱼传尺愫 2020-11-28 07:38

I want to unwrap two optionals in one if statement, but the compiler complaints about an expected expression after operator at the password constant. What could be the reaso

8条回答
  •  日久生厌
    2020-11-28 07:51

    Update for Swift 3:

    if let email = emailField?.text, let password = passwordField?.text {
    }
    

    each variable must now be preceded by a let keyword

提交回复
热议问题