Compare to nil and return a bool in Swift

前端 未结 3 1271
旧巷少年郎
旧巷少年郎 2021-01-21 03:05

UPDATE: This question is no longer a problem after Xcode beta5

Seems the beta3 release refactored how \"nil\" is working under the hood but didn\'t com

3条回答
  •  Happy的楠姐
    2021-01-21 03:43

    This was working for me:

    func hasLogin() -> Bool {
        return self.credential ? true : false
    }
    

提交回复
热议问题