Swift-如何弃用SPM库中的函数

我们正在维护一个私有 SPM 库,我想介绍一个应该使用的函数,而不是现有函数。最终结果应该是某种弃用

到目前为止,我发现可以相对于操作系统版本弃用函数,但我需要相对于库版本弃用它。

例如:

//how do I deprecate this function as of version `1.1.0` of my library?
func oldFunc() {
    ...
}

//It will be awesome if I could also mention that this function is the newer alternative to `oldFunc`
func newFunc() {
    ...
}

回答

你可以使用这样的东西:

@available(*, deprecated, renamed: "newFunction")
func sampleFunction() { }


以上是Swift-如何弃用SPM库中的函数的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>