Hello,
I've been trying to imagine how to support ensuring the display of my tips in the order I want them to for iOS 17. I am familiar with the TipGroup iOS18 feature, but I'm looking to control the order without TipGroup so I can deliver a great user experience in my iOS 17 and > app.
I've tried lots of theories, but can't seem to figure it out and I don't see anyone else having solved it. Any ideas/code examples anyone could point me to?
Thanks!
Post
Replies
Boosts
Views
Activity
I've seen an earlier post on this with no response.
Has anyone else gotten a response from Apple or have run across a solution to onDrag lagging when released to drop on iOS 18? I've been chasing this for a week thinking it was me and then I woke up and started testing it on older iOS versions and the issue goes away. I happens on simulators and real phones. A little more digging and I'm seeing occasional chatter about this .5 to 1 second delay.
Here's a code example that reproduces it:
import SwiftUI
import UniformTypeIdentifiers
struct ContentView: View {
@State private var draggableText: String = "Move this"
var body: some View {
VStack(spacing: 80) {
DraggableItem(content: $draggableText)
DropZone {
Text("Place Here!")
.font(.headline)
.foregroundColor(.white)
}
.frame(width: 150, height: 150)
.background(Color.green)
.cornerRadius(12)
}
.padding()
}
}
struct DraggableItem: View {
@Binding var content: String
var body: some View {
Text(content)
.frame(width: 120, height: 120)
.background(Color.red)
.foregroundColor(.white)
.cornerRadius(8)
.onDrag {
NSItemProvider(object: NSString(string: content))
}
}
}
struct DropZone<Content: View>: View {
var content: () -> Content
var body: some View {
ZStack {
content()
}
.onDrop(of: [UTType.text], delegate: DropHandler())
}
}
struct DropHandler: DropDelegate {
func performDrop(info: DropInfo) -> Bool {
// Add logic to handle the drop
print("Item dropped!")
return true
}
}
#Preview {
ContentView()
}