SwiftUI DragGesture blocking List vertical scroll?
The solution is to give different distance for swipe, like below
struct cl_task: View {
@State private var offset: CGSize = .zero
var body: some View {
// give 25 distance makes vertical scroll enabled !!
let drag = DragGesture(minimumDistance: 25, coordinateSpace: .local)
.onChanged {
Tested with Xcode 12.4 / iOS 14.4
SwiftUI overlay cancels touches
The following code works on Xcode 11.2 / iOS 13.2
struct TestButtonWithOverlay: View {
var body: some View {
Button(action: {
print("Pressed")
}) {
Text("Press me")
.padding()
}
.overlay(
LinearGradient(
gradient: Gradient(colors: [.clear, Color.black.opacity(0.3)]),
startPoint: .top,
endPoint: .bottom
)
.allowsHitTesting(false) // !!! must be exactly here
)
}
}
SwiftUI: Dynamically move navigationBar items on List scroll
i am not sure what you want, but the reason for this behavior is your offset.
Try this:
struct ContentView: View {
var body: some View {
NavigationView {
List {
ForEach(UIFont.familyNames, id: \.self) { name in
Text(name)
}
}.navigationBarTitle("Title")
.navigationBarItems(leading:
HStack {
Button(action: {
// action
}) {
HStack {
Text("Upcoming")
Image(systemName: "chevron.down.circle")
.font(.system(size: 21, weight: .regular))
// .offset(x: 169, y: 47)
.foregroundColor(Color.orange)
}
}
})
}
}
}
Related Topics
How to Disable "Save to Files" in iOS 11
Add a Xib File to a Swift Package
Avaudiosinknode with Non-Default, But Still Device-Native Sample Rates
Swiftui Multiline Text Background Color
Iwatch: Wkinterfacelabel How to Stop Text from Being Cut Off with "..." at The End of a Label
Arkit/Realitykit - People Occlusion Config Not Working
How to Convert Bytes to Nsstring After Aes Cryptoswift Cipher
Swift Compiler Error Int Is Not Convertible to Cgfloat
How to Read File Data Applications Document Directory in Swift
How to Respond with an Image Using Vapor
Xcode - Build Setting "Excluded_Source_File_Names" Not Working
iOS 10 Notification Content Extension Not Loading
How to Make Deinit Take Effect in Swift
Provide Simple Method to Get Current Speed (Implementing Speedometer)
Differences Between Filtering Realm with Nspredicate and Block