gpt4 book ai didi

swift - 什么替换了 init(name :float:) now that it has been deprecated

转载 作者:搜寻专家 更新时间:2023-11-01 07:20:14 24 4
gpt4 key购买 nike

我收到一条警告,指出 init(name:float:) 已被 Swift3 弃用。有谁知道它被什么取代了?

问题出现在着色器中:

SKUniform(name: "size", 
float:GLKVector3Make(
Float(self.frame.size.width),
Float(self.frame.size.height), 0)),

最佳答案

来自iOS 10 Release Notes :

iOS 10 deprecates several APIs, including:

...

Several SKUniform symbols related to floating point values. Instead, use methods such as initWithName:vectorFloat2: and uniformWithName:matrixFloat2x2:, as appropriate.

例如:

SKUniform(name: "size", 
vectorFloat2:vector2(
Float(self.frame.size.width),
Float(self.frame.size.height)
))

关于swift - 什么替换了 init(name :float:) now that it has been deprecated,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39550725/

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