gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 16:18:37 24 4
gpt4 key购买 nike

我们正在维护一个私有(private)的 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 库中的函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66068396/

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