- August 28, 2025
- Mins Read
You can install ElongationPreview in several ways:
pod ‘ElongationPreview’
github “Ramotion/elongation-preview”
First of all, import module to your source file.
import ElongationPreview
Then subclass ElongationViewController and configure it as you wish.
class RootViewController: ElongationViewController { }
Now you must register reusable cell in tableView. If you prefer to use Storyboards, you can drag UITableViewCell from bottom-right menu, lay it out and change it’s class to ElongationCell. Of course, there are some specific requirements on how you can configure cell’s subviews.
Easier way: copy DemoElongationCell from demo project and change it as you wish. Add your own views to top, bottom and scalable containers.
If you want to create cell from scratch, this is how your cell hierarchy should look like:
bottomView — the view which comes from behind the cell when you tap on the cell.
scalableView — the view which will be scaled when you tap on the cell.
topView — static top view, add here all the views which won’t be scaled and must stay on their position.
Also you must connect this constraints: topViewHeightConstraint, topViewTopConstraint, bottomViewHeightConstraint, bottomViewTopConstraint.
📌 If you need to override
func scrollViewDidScroll(_ scrollView: UIScrollView)
or
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath)
you must call super because some important configuration was made in these methods in superclass (ElongationViewController).
class DetailViewController: ElongationDetailViewController { }
If you want to display some details for objects from the root view, it’s better to subclass ElongationDetailViewController and configure it for displaying your data.
This class holds headerView property which actually represents ElongationCell in expanded state and it’ll be used as a header for tableView by default.
📌 Override openDetailView(for: IndexPath) method, create your ElongationDetailViewController instance and call expand(viewController: ElongationDetailViewController, animated: Bool) method with this instance.
This is the place where you need to configure your ElongationDetailViewController subclass.
You can customize both appearance & behaviour of ElongationPreview control by tuning some params of ElongationConfig and overriding shared instance.
// Create new config.
var config = ElongationConfig()
// Change desired properties.
config.scaleViewScaleFactor = 0.9
config.topViewHeight = 190
config.bottomViewHeight = 170
config.bottomViewOffset = 20
config.parallaxFactor = 100
config.separatorHeight = 0.5
config.separatorColor = .white
// Save created config as `shared` instance.
ElongationConfig.shared = config
🗒 All parameters with their descriptions listed in ElongationConfig file.
This package provides you with an easy way to show tooltips over any SwiftUI view, since Apple does not provide ...
SimpleToast is a simple, lightweight, flexible and easy to use library to show toasts / popup notifications inside iOS or ...
Create Toast Views with Minimal Effort in SwiftUI Using SSToastMessage. SSToastMessage enables you to effortlessly add toast notifications, alerts, and ...