1 //  Copyright (c) 2018, Applidium. All rights reserved
2 //  PassThroughView.swift
3 //  OverlayContainer
4 //
5 //  Created by Gaétan Zanella on 14/11/2018.
6 //
7 
8 import UIKit
9 
10 /// A protocol that provides information about an in-progress translation.
11 /// Do not adopt this protocol in your own classes. Use the one provided by the `OverlayTranslationFunction`.
12 public protocol OverlayTranslationParameters {
13     /// The mininum translation height
14     var minimumHeight: CGFloat { get }
15     /// The maximum translation height
16     var maximumHeight: CGFloat { get }
17     /// The user finger translation
18     var translation: CGFloat { get }
19 }
20 
21 /// A `OverlayTranslationFunction` defines the relation between the user finger translation
22 /// and the actual overlay translation.
23 ///
24 /// Adopt this protocol to tweak the native translation behavior. You can also use the provided
25 /// implementations like `RubberBandOverlayTranslationFunction`.
26 public protocol OverlayTranslationFunction {
27     /// Returns the expected translation based on the specified parameters.
overlayTranslationHeightnull28     func overlayTranslationHeight(using parameters: OverlayTranslationParameters) -> CGFloat
29 }
30