A UIView subclass that mimics the video player panning in the current YouTube iOS and Android apps.
Copy the TFSwipeShrinkView.swift
file into your Xcode project and you are ready.
View ExampleViewController.swift
to see an example of adding a video on top of a TFSwipeShrinkView
.
- Create a UIView in storyboard giving it a custom class of
TFSwipeShrinkView
. I suggest placing it at the top of your viewcontroller just as the YouTube app does. - In the viewcontroller implementing your TFSwipeShrinkView, within the
viewDidAppear
method call theconfigureSizeAndPosition(parentViewFrame: CGRect)
on your swipe shrink object.
From here, everything should just work. It is up to you the developer to add whatever you want on top of the swipe shrink view, such as a video or an image. In it's default state, you should have something that looks like this.
Created by Taylor Franklin (tfrank64)
- Create a secondary view below shrink view, similar to YouTube app.
Feel free to fork the repo and open a pull request. Using fairly normal convention, make changes in your forked repo, then submit a pull request.
To view some of the original Objective-C code for this project, check out the ObjCSwipeShrink
directory.
TFSwipeShrink is licensed under the MIT license.