How to implement Lion style swipe and slide away animation - cocoa

I am wanting to implement history navigation in my app that mimics the slide away animation found in Safari on Lion and in XCode where a top view slides away at the speed of swipe to reveal the view underneath it.
I was looking for pointers on how to do this. I know how to detect the swipe. I assume I could implement the animation via a CALayer animation slide transition on the top view revealing a view underneath it. Has anybody else done this and can offer some further pointers?

It's a new NSEvent method, -trackSwipeEventWithOptions:.... You should call it from within your regular scroll/swipe event handler, whenever you decide the gesture should begin. Unfortunately it doesn't automatically handle the page animations — it just gives you updates with the gesture amount, and you have to do the animations yourself (using layers or views or somesuch). You'll probably want to save images of each page so you can animate them around during a gesture.

Related

Using infinite scrolling UICollectionView with iOS 13 pullable modals

I have a modal window, which is perfect for iOS 13's drag to dismiss gesture, because this way the user remains in the context, so I don't want to use full screen. The controller contains a UICollectionView which displays a month calendar, which is scrollable vertically.
The problem is, that when the user wants to scroll upwards in the collection view, the dismiss gesture is triggered instead. If I scroll down first, then can I only scroll up.
I've tried to disable the internal UIPanGestureRecognizer (it seems somehow there is no presentedView, so it didn't work), tried to set the UICollectionView's pan gesture recognizer delegate to prevent the system recognizer to fire (it turned out you can't do that), and tried to scroll the collection view on appearing a bit (ugly).
How can I elegantly convince the the modal presentation, that my scrollview isn't scrolled to the top?

Xamarin.ios Segue Animation

I have a storyboard that at some point moves from one view to another, but the animations that area available to the segway are Cover Vertically, Flip Horizontally, Cross dissolve and partial curl. I need to have a "Slide to the right" animation. How can I add this?
Also, I'm able to use this kind of animations if the segue is Modal type, which as I understand is a view being drawn over the other view. I would like to "Push", as I understand pushing discards the past view.

In React Native, Can I bind swipe/scroll of a SectionList to another View

I have a SectionList which scrolls/swipes vertically. Can I bind a swipe gesture on it, so that it results in swiping a completely separate View which is behind it? Furthermore, is there an example someone could lead me to, in which a swipe gesture on a SectionList is bound to the animation of another object or objects? Here is a good example of what I am trying to achieve:
When the view is scrolled vertically in the example above it causes a menu to animate in from the top. That is close to the desired effect I'm seeking. I'd also love to know how to achieve that rotational animation tied to the horizontal swipe. I'm thinking that I will likely need the Animated API for this kind of behavior. Any tutorials or code examples you have would really help.

UIScrollView on tvOS

The question is very simple, how to enable scroll and zoom inside a UIScrollView in tvOS?
I tried the same initializer code from iOS and returned the scrollview for the focusedView var, but nothing happens when i touch the remote.
Also, i tried to add another custom UIPanGestureRecognizer to the scrollview and actually it works, but i don't want to handle the pan with custom code, just use the same pan behavior like iOS.
Let me know, thanks.
You can configure the scroll view's built-in pan gesture to recognize touches on the Siri Remote. It doesn't do that automatically, because normally scroll views on tvOS aren't scrolled directly by touches: they're scrolled automatically as focus moves between views within the scroll view.
If you really want the scroll view to move directly from touches, you'll need to add UITouchTypeIndirect to the allowedTouchTypes of the scroll view's panGestureRecognizer:
scrollView.panGestureRecognizer.allowedTouchTypes = #[ #(UITouchTypeIndirect) ];
You'll also need to make sure that either the scroll view itself is the focused view, or is a parent of the focused view, since all touches from the remote will start at the center of the focused view: you need to make sure the scroll view is getting hit-tested for the events to work.
Zooming won't work, because the Siri Remote can only recognize one touch at a time, so you can't do a pinch gesture on it.
Swift 4 version (from here: https://stackoverflow.com/a/41000183/945247)
scrollView.panGestureRecognizer.allowedTouchTypes = [NSNumber(value:UITouchType.indirect.rawValue)]

Scrolling effect like iCal's week view in Lion

I am working on cocoa for 1 month. I am working on application where I need to have my own custom week view, which is more compact then ical, but what I want is the nice scrolling animation which ical gives when we move from one week to another.
Currently I am using NSView Animation, having two views, one is buffer view and one is main view. What i do is before animation i put buffer view in the right position then simply changes the both views, frame origin to get the animation effect. So far it does the job but doesn't seems to be as good as ical.
I tried core graphics but couldn't able to get the same scrolling effect which ical gives.

Resources