MPParallaxView
  • September 16, 2023

Apple TV Parallax effect in Swift. Rotate view using touch or accelerometer.

Usage


To run the example project, clone the repo, and run pod install from the Example directory first.

Want to quickly look at demo? Type pod try MPParallaxView!

Parallax effect


You can easily customize Parallax View in Storyboard! Jump into Example project to look at properties.

How about accelerometer parallax instead of touch? Set Accelerometer Enabled to On in Storyboard.

There are 3 different ways to set up parallax:

  • .basedOnHierarchyInParallaxView – views in background moves less than views in foreground. You can increase the movement by changing multiplerOfIndexInHierarchyToParallaxOffset – this value will be multiplied by index of view in hierarchy. Default.
  • .basedOnTag – set a tag for a view. For instance, snowflakes image view has 13 tag which means noticeable movement. On the other hand, top view with cast members has 1 tag – almost no movement.
  • .custom(Int) – provide your custom value.

Requirements


Xcode 8, iOS 9

Installation


MPParallaxView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod “MPParallaxView”

GitHub


View Github

#ios #swift
YOU MIGHT ALSO LIKE...
Untitled

    

How to take action when a property changes

1. Taking Action When a Property Changes: Property Observers Swift lets you observe and respond to changes in a property’s ...

How to create your own structs? How to compute property values dynamically?

1. Creating Your Own Structs In Swift, a struct is a value type that you define with the struct keyword. ...

How to use trailing closures and shorthand syntax?

1. Trailing Closure Syntax When the last parameter to a function is a closure, you can write that closure after ...

How to create and use closures?

1. What Is a Closure (and Why Swift Loves Them) A closure in Swift is a self-contained block of functionality ...