swift - 从 C 导入的扩展结构
问题描述
我是 Swift 的新手,我有这个扩展:
extension UIView.KeyframeAnimationOptions {
init(animationOptions: UIView.AnimationOptions) {
rawValue = animationOptions.rawValue
}
}
由于 Swift 4.2rawValue = animationOptions.rawValue
产生了这个警告:
Initializer for struct 'UIView.KeyframeAnimationOptions' must use "self.init(...)" or "self = ..." because the struct was imported from C
我使用这样的扩展名:
UIView.animateKeyframes(withDuration: 1.2, delay: 0.0, options: [.repeat, UIView.KeyframeAnimationOptions(animationOptions: .curveEaseOut)], animations: {
...
}
如何从 中修复此警告消息struct was imported from C
?
解决方案
推荐阅读
- java - 如何在 JSON 数组中发送特定数据
- python - 使用 lambda 的阶乘函数
- javascript - 如何为具有 javascript 值的选择框制作占位符?
- java - 如何在Android中制作和处理将json文件作为响应的Http请求?
- python - 如何将 pandas DataFrame 转换为计数表?
- excel - 根据位置重新排列单元格内容
- python - 如何在不包含无的情况下单行打印数据框?
- reactjs - cartItems 数组和 localStorage 未更新
- amazon-web-services - 如何在 AWS IoT 中创建订阅主题
- vba - 在不使用 forloop 的情况下获取 Style 内置计数?