/// Appends a path component to the URL.
///
/// - note: This function performs a file system operation to determine if the path component is a directory. If so, it will append a trailing `/`. If you know in advance that the path component is a directory or not, then use `func appendingPathComponent(_:isDirectory:)`.
/// - parameter pathComponent: The path component to add.
@available(macOS, introduced: 10.9, deprecated: 100000.0, message: "Use append(path:directoryHint:) instead")
@available(iOS, introduced: 7.0, deprecated: 100000.0, message: "Use append(path:directoryHint:) instead")
@available(tvOS, introduced: 9.0, deprecated: 100000.0, message: "Use append(path:directoryHint:) instead")
@available(watchOS, introduced: 2.0, deprecated: 100000.0, message: "Use append(path:directoryHint:) instead")
public mutating func appendPathComponent(_ pathComponent: String)
1条答案
按热度按时间nuypyhwy1#
替换为
append(path:directoryHint:)
。如果你使用Xcode的代码完成功能,你可以清楚地看到这一点。
Xcode显示了一个可能匹配的列表,它将显示弃用的方法,并提到替换。
另一个选择是右键单击代码中
appendPathComponent
的用法,然后选择“跳转到定义”,这将带您进入Foundation.URL的接口文件,在那里您将看到类似以下的内容:@available
行显示替换。这是Xcode显示替换的方式。不确定为什么在线文档和Xcode的开发者文档窗口不显示替换。