jungseungyeo / SwiftyContainer

SwiftyContainer is very Ez animation!! πŸ˜€ πŸ‘» πŸ§‘β€πŸ’»

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SwiftyContainer

Swift CocoaPods License

Install

  pod 'SwiftyContainer'

How to use


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
}()

Show Container

func show() {

    swiftyContainerInteractor.showDidAppear = {
      // didShowAppear
    }

    swiftyContainerInteractor.show()
}

Hide Container

func hide() {

    swiftContainerInteractor.hideDidAppear = {
      // didHideAppear
    }

    swiftyContainerInteractor.hide()
}

screenshot

Catch Error

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:
        // ...
    }
}

Author

LinSaeng

License

SwiftlyIndicator is licensed under the MIT license. Check the LICENSE file for details./LICENSE) file for details.

About

SwiftyContainer is very Ez animation!! πŸ˜€ πŸ‘» πŸ§‘β€πŸ’»

License:MIT License


Languages

Language:Swift 92.2%Language:Ruby 5.4%Language:Objective-C 2.4%