Post

Replies

Boosts

Views

Activity

How to subclass NSScrollView that is used in sections in NSCollectionViewCompositionalLayout?
Hello! I am digging a lot recently in compositional layout and I wanted to "merge" scrolling views with other collection view, but the issue is NSCollectionView has a NSScrollView instance for whole view and one instance per section (with continuous scrolling behavior). The question is how can I reach those scroll views that are holding sections? Can I subclass it or listen for mouse events without breaking basic functionality? I am building app in Swift, but I can jump into Obj-C land if I have to.
Topic: UI Frameworks SubTopic: AppKit Tags:
0
0
525
May ’21
Magnification gesture to scale ScrollView's content.
Hello! I am trying out new SwiftUI and I have to say that I love it, but I've got some problems implementing few features. First issue is that I am not sure how can I scale content of ScrollView, to make content of that View smaller, but there would be more subviews visible. Here's my code: @State private var scale: CGFloat = 1.0 var body: some View { ScrollView([.horizontal]) { HStack(alignment: .top) { ForEach(0..<5, id: \.self) { _ in ScrollView(.vertical) { LazyVGrid(columns: [GridItem(.fixed(300), spacing: 10)], spacing: 10) { ForEach(0..<5, id: \.self) { _ in Rectangle() .frame(width: 300, height: 300, alignment: .center) } } } .padding(.leading, 10) } } .scaleEffect(scale) } .gesture( MagnificationGesture() .onChanged { value  in scale = value.magnitude }) } } If You paste that code to a project, You will see that app scales whole ScrollView, not its content. And when we're talking about gestures, I would really appreciate if someone would share here how can I prioritize the gestures. Thanks for reading!
2
1
2.6k
Jun ’20