![](/img/trans.png)
[英]Compile error for passing nil to an optional parameter with a generic type constraint
[英]Error expected : Ternary conditional nil for not optional type of parameter in SwiftUI function
即使可选类型不是.gesture()
修饰符真正想要的参数类型,下面的代码也可以正常工作。
someKindOfView
.gesture(condition ? DragGesture() : nil)
为什么这可能?
非常感谢!!!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.