![](/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.