[英]Editing effect properties with KeyPath
尝试使用以下方法编辑AKCompressor属性:
let compressor = AKCompressor()
compressor[KeyPath: \AKCompressor.threshold ] = 3
出现此错误...类型“ AKCompressor”没有下标成员
与其他效果相同。 需要使用KeyPath访问属性以在一个类中统一一些效果
你有错字
var compressor = AKCompressor()
compressor[keyPath: \AKCompressor.threshold ] = 3
注意,下标keyPath不是KeyPath
另外,请确保AKCompressor如果是结构,则为var即。 可变的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.