Post

Replies

Boosts

Views

Activity

DragGesture + ScrollView = problems. Any good workarounds?
When placing a DragGesture on a view containing a ScrollView, dragging within the ScrollView causes onChanged to trigger, while onEnded does not trigger. Does anybody have a workaround for this?struct ContentView: View { @State var offset: CGSize = .zero var body: some View { ZStack { Spacer() Color.clear if self.offset != .zero { Color.blue.opacity(0.25) } VStack { Color.gray.frame(height: 44.0) ScrollView { ForEach(0..<100, id: \.self) { _ in Text("Don't move please") } } Color.gray.frame(height: 44.0) } .frame(width: 320.0, height: 568.0) .offset(self.offset) .animation(.easeInOut) .gesture( DragGesture(minimumDistance: 10.0, coordinateSpace: .global) .onChanged { (value) in self.offset = value.translation } .onEnded { (_) in self.offset = .zero }) } } }I know I could place gestures on the top/bottom gray areas (they represent bars), but in my actual app the owner of the drag gesture is a container that knows nothing about its contents.
3
3
7.4k
Sep ’19
Xcode opening all files as text
Xcode is opening all of my storyboards and xcassets files as text. The menu option for "Open As..." now contains just one grayed out entry "<None>. When re-opening Xcode with an xcasset file it does say "No editor" for a moment before opening the file as text. I did install a macos update this morning which may have triggered this but I can't be sure. Is anybody aware of a fix for this?
2
2
3.8k
Jun ’16