Home

Awesome

PGS Software

ParallaxView

Swift 5.0 CocoaPods Compatible Carthage Compatible SPM Compatible Platform License

Summary

Easy to use UIView, UICollectionViewCell with parallax effect and extensions to add this effect to any UIView. Rotate view using Apple TV remote. Works confusingly similar to tiles in the home screen of the Apple TV.

ParallaxView ParallaxView

ParallaxView

Open your storyboard or xib and drag and drop UIView control. Change custom class to ParallaxView in Identity inspector. You can also create control from code.

ParallaxCollectionViewCell

In Interface builder change collection view cell class to ParallaxCollectionViewCell or do it from code.

You can also create subclass of ParallaxCollectionViewCell insted of UICollectionViewCell and use it as normal collection view cell.

Extension

If ParallaxView and ParallaxCollectionViewCell don't fit to your needs you can use extension that can be used with any UIView. In many cases it can look like in this example:

override func didUpdateFocus(in context: UIFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) {
	coordinator.addCoordinatedAnimations({
		if context.nextFocusedView === yourCustomView {
			yourCustomView.addParallaxMotionEffects()
		}
		if context.previouslyFocusedView === yourCustomView {
			yourCustomView.removeParallaxMotionEffects()
		}
	}, completion: nil)
}

It is important to add and remove parallax effect inside the animation block to avoid the glitches. ParallaxView and ParallaxCollectionViewCell internally use the same methods. For more details look into example.

Customisation

The component is documented in code, also look into example for more details.

Documentation

Properties

ParallaxView and ParallaxCollectionViewCell have the same properties for customisation.

Requirements

Swift 5.0, tvOS 9.0

Installation

Add line to Podfile

# ...
target 'MyApp' do
  # your other pod
  # ...
  pod 'ParallaxView'
end
# ...

Add a line to Cartfile:

github "PGSSoft/ParallaxView"

Xcode 12 (Swift 5.3) required!

In Xcode:

Select File > Swift Packages > Add Package Dependency. Enter https://github.com/PGSSoft/ParallaxView

If you would like to check more details please visit the Apple's documentation

You can download the latest files from our Releases page. After doing so, drag ParallaxView.xcodeproj into your project in Xcode, and for your project target on General tab in Embedded Binaries section add ParallaxView.framework. Example project is configured the same way, so you have the crib sheet.

Usage

import ParallaxView

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/PGSSoft/ParallaxView.

License

The project is available as open source under the terms of the MIT License.

About

The project maintained by software development agency PGS Software. See our other open-source projects or contact us to develop your product.

Follow us

Twitter URL
Twitter Follow