admin管理员组文章数量:1391008
Consider a SwiftUI view that's using the .onDrop
modifier:
struct Blah: View
{
@State private var isDraggingActive: Bool
var body: some View
{
...
}
.onDrop(of: [.fileURL], isTargeted: $isDraggingActive.animation(.easeInOut(duration: 0.15)), perform: { providers in
...
})
}
This lets our view nicely animate its state when a drag enters. Works great. But, if we need full control over validating the drag and use the delegate .onDrop
method, instead, what is the right way to achieve the same animated updating of isDraggingActive
?
struct Blah: View
{
var dragDelegate = MyDragDelegate()
@State private var isDraggingActive: Bool
var body: some View
{
...
}
.onDrop(of: [.fileURL], delegate: dragDelegate) // How do we update the isDraggingActive state with animation here?
}
本文标签: swiftHow do you use SwiftUI39s onDrop( delegate) view modifier with animationStack Overflow
版权声明:本文标题:swift - How do you use SwiftUI's .onDrop(_: delegate:) view modifier with animation? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744590069a2614433.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论