gpt4 book ai didi

swift - 函数中参数之前的参数标签 - Swift 标记中可能存在错误?

转载 作者:IT王子 更新时间:2023-10-29 05:37:57 24 4
gpt4 key购买 nike

我在一个类中有以下功能:

/// Returns the weather conditions at the given location.
/// - parameter for: A location on the Earth's surface.
/// - returns: If found, the `WeatherConditions` at the supplied location otherwise nil.
public func conditions(for location: Location) -> WeatherConditions? {
return nil // The actual code is not important to the question.
}

调用如下 let myWeather = conditions(for: myLocation)

代码工作正常,问题是关于文档的。下图是在conditions 函数的“快速帮助”窗口中看到的内容。鉴于函数的用户必须使用外部参数标签 (for) 并且我已经明确记录了该标签,快速帮助窗口中的参数行不应该阅读 Parameters for 而不是 参数位置

这是 Xcode 中的错误还是显示(内部)参数名称而不是外部参数标签的原因?

enter image description here

最佳答案

很简单,for 不是参数; 位置 是。快速帮助是记录参数。

如建议的那样,希望快速帮助将 for 识别为地球表面的某个位置,这会让读者感到有些困惑。

SPLGAPI Design Guidelines使用术语“参数”和“参数标签”(如您的问题标题)而不是“内部参数”和“外部参数”(这可能会导致您提出的混淆)。鉴于此,参数位于快速帮助中的参数标题下,参数标 checkout 现在声明中。

关于swift - 函数中参数之前的参数标签 - Swift 标记中可能存在错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39033410/

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