pod 'SwiftyContainer'
import SwiftyContainer
// crate Interactor
lazy var swiftyContainerInteractor: SwiftyContainerInteractorable = {
struct Component: SwiftyComponentable {
var leftMarginOffset: CGFloat { 10 }
var rightMarginOffset: CGFloat { -10 }
var bottomMarginOFfset: CGFloat { 10 }
}
let component = Component()
let composition = SwiftyCompositionContainer.resolve(parentsView: view,
animationView: containerView,
component: component)
let container = SwiftyContainerBuilder(dependency: composition).create()
return container
}()
func show() {
swiftyContainerInteractor.showDidAppear = {
// didShowAppear
}
swiftyContainerInteractor.show()
}
func hide() {
swiftContainerInteractor.hideDidAppear = {
// didHideAppear
}
swiftyContainerInteractor.hide()
}
import SwiftyContainer
override func viewDidLoad() {
super.viewDidLoad
swiftyContainer.error = { error in
// erorr catch
// error type is SwiftyContainerError
self.errorHandler(error: Error)
}
}
func errorHandler(error: Error) {
guard let swiftyContainerError = error as? SwiftyContainerInteractorError else { return }
switch swiftyContainerError {
case .alreadyShow:
// ...
case .alreadyHide:
// ...
case .duringAnimation:
// ...
case .unknown:
// ...
}
}
SwiftlyIndicator is licensed under the MIT license. Check the LICENSE file for details./LICENSE) file for details.