CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.

FloatWindow 1.1.2

FloatWindow 1.1.2

Maintained by janlionly.



FloatWindow

Version License Platform Swift

FloatWindow demo image

Description

FloatWindow like WeChat's floating ball can open a controller and hide it into a ball.

Installation

CocoaPods

pod 'FloatWindow'

Usage

 // init FloatWindow
 FloatWindow.shared.ballWidth = 60
 FloatWindow.shared.isShowPanExitView = true // pan to show exit view
 FloatWindow.shared.ballImage = UIImage(named: "beauty")
/* optional: set init stay postion (default: right of screen edge, middle of horizon)
        let screenSize = UIScreen.main.bounds
        FloatWindow.shared.stayPoint = CGPoint(x: screenSize.width - FloatWindow.shared.ballWidth - 10, y: 600)
// */
 
 // push a new controller to FloatWindow
 let controller = UIViewController()
 controller.view.backgroundColor = .yellow
 FloatWindow.shared.push(root: controller, in: self.navigationController)

 // hide the controller in FloatWindow
 FloatWindow.shared.hide()

 // show the origin controller in FloatWindow
 FloatWindow.shared.show()

 // or destroy the controller in FloatWindow
 FloatWindow.shared.destroy()

 // other properties
 FloatWindow.shared.ballView.addSubview(customView) // add custom view into ball you like
 FloatWindow.shared.nav = currentNav // change nav, push method set this property
 FloatWindow.shared.imageView = customImageView
 FloatWindow.shared.userInfo = ["saved": "yourInfo"]

 if FloatWindow.shared.isHideIntoBall {
     // hide into ball, do something
 }

Requirements

  • iOS 9.0+
  • Swift 4.2 to 5.1

Author

Visit my github: janlionly
Contact with me by email: [email protected]

Contribute

I would love you to contribute to FloatWindow

License

FloatWindow is available under the MIT license. See the LICENSE file for more info.