Floating 0.0.3

Floating 0.0.3

Maintained by hirohisa.



Floating 0.0.3

  • By
  • Hirohisa Kawasaki

Floating

CocoaPods Carthage compatible license

Floating is a very flexible overlay library.

Requirements

  • iOS 10.0+
  • Xcode 9.2+, Swift 4.1

CocoaPods

pod 'Floating'

Carthage

github "hirohisa/Floating"

Usage

FloatingView<T: UIView>

present

import Floating

func didTapButton(_ sender: UIButton) {
  let handler: FloatingView<UITextField>.Handler = { (state, object) in
      print(state)
      print(object)
  }
  FloatingView(view)
      .configure(backgroundColor: backgroundColor, handler: handler)
      .present(from: sender.frame)
}

Handling with Life Cycle

Observer

// Notification.Name

let FloatingViewWillPresent
let FloatingViewDidPresent
let FloatingViewWillDismiss
let FloatingViewDidDismiss


NotificationCenter.default.addObserver(forName: .FloatingViewWillPresent, object: nil, queue: nil) { (notification) in
  ...
}

Closure

// State

enum FloatingView.State {
    case willPresent
    case didPresent
    case willDismiss
    case didDismiss
}

let handler: FloatingView<T>.Handler = { (state: State, object: T) in
  ...
}
FloatingView(view)
    .configure(handler: handler)

License

Floating is available under the MIT license.