Tag: 后卫

Swift:Nil与返回typesString不兼容

我在Swift中有这样的代码: guard let user = username else{ return nil } 但是我收到以下错误: Nil is incompatible with return type String 你们中的任何一个人都知道在这种情况下为什么或者如何返回零? 我会很感激你的帮助