OLManager
Overlay Manager is a lightweight, easy-to-use, written on Swift - helper, which will provide you the convenient API to manage your custom overlays lifecycle with avoiding code repeating.
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
Installation
OLManager is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'OLManager'
Implementation Examples
import OLManager
enum YourCustomOverlays: OverlayLevelHolder {
case successOverlay
case failurOverlay
var level: YourCustomOverlays {
switch self {
case .successOverlay:
return .global
case .failurOverlay:
return .local
}
}
}
final class OverlayFactoryImp: OverlayFactory {
func makeOverlayWith(type: YourCustomOverlays) -> UIView {
switch type {
...
}
}
}
final class OverlayManagerProvider {
static let provider = OverlayManagerProvider()
var overlayManager: OverlayManagerOf<OverlayFactoryImp>
init() {
let factory = OverlayFactoryImp()
overlayManager = OverlayManagerOf<OverlayFactoryImp>(factory: factory)
}
}
final class ViewController: BaseViewController {
let overlayManager = OverlayManagerProvider.provider.overlayManager
var overlayManageable: OverlayManageable?
// MARK: UserInteraction
@IBAction func testButtonAction(_ sender: Any) {
let location = PinningLocation(horizontalEdge: .left, verticalEdge: .top)
let config = OverlayDisplayConfiguration(animationType: .slide, pinningLocation: location)
overlayManageable = overlayManager.displayOverlay(OverlayViewType.'your overlay type', configuration: config)
}
}
Author
MaxOstPM, [email protected]
License
OLManager is available under the MIT license. See the LICENSE file for more info.