gpt4 book ai didi

ios - 为什么 Apple 使用此 "if let"代码?

转载 作者:行者123 更新时间:2023-11-28 11:14:30 25 4
gpt4 key购买 nike

<分区>

Apple 在他们的一个示例项目中有这段代码:

    let existingImage = cache.objectForKey(documentIdentifier) as? UIImage

if let existingImage = existingImage where cleanThumbnailDocumentIDs.contains(documentIdentifier) {
return existingImage
}

为什么苹果要使用这个if let?简单地使用是不是更合乎逻辑

    if cleanThumbnailDocumentIDs.contains(documentIdentifier) {
return existingImage!
}

???!!

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com