Skip to content

Latest commit

 

History

History
118 lines (91 loc) · 3.97 KB

README.md

File metadata and controls

118 lines (91 loc) · 3.97 KB

BSFloatListView

CI Status Version License Platform



Click youtube image below to watch BSFloatListView sample in action.
BSFloatListView

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

iOS 10.0+
Swift 4.2 +

How to use


First things first,
Step 0. import BSFloatListView

Step 1. Create Instance programmatically as an instance variable
Declare and create instance as an instance variable as below.
BSFloatListView is only supported in a programmatical way.

/**
* initiating floatListView instance..
/// Used to create floatList instance from nib file to return.
///
/// - warning:  Mind whether isSticky is true or false will make difference of usage. Check detail in example source.
/// - parameter observedTouchView: a targetView to react on.
/// - parameter dataList: string array to display on the list.
/// - parameter touchDetectionMode: choose recognizer type for either short tap(.short) or long press(.long)
/// - parameter isSticky: if true, rather than floating around, stick to and show floatListView on a given observedTouchView in the first parameter.
/// - returns: BSFloatListView instance
*/

private lazy var floatListView: BSFloatListView = { [unowned self] in
  let floatListView = BSFloatListView.initialization(
    on:
      observedTouchView,  // a view to stick to and to focus on.
    with:
      dataList, // data list to show in the BSFloatListView ["Java", "Swift", "Scala", "Kotlin", "C++", "Clojure"] 
    touchDetectionMode:
      touchDetectionMode, // either .short or .long. if you want long press to invoke BSFloatListView, go for .long.  
    isSticky:
      isSticky // true
    )
    
    /// a closure for which list to choose.
    floatListView.didSelectRowAtClosure = { [unowned self] indexPath in
      print("clicked at : ", indexPath.row)
    }
  return floatListView
}()

isSticky is important.
If isSticky is true, BSFloatListView just keeps staying at CGPoint(x:0, y:0) of observedTouchView you specified regardless of which location a user tapped to use BSFloatListView within the observedTouchView frame.
Otherwise, BSFloatListView just follows a location a user tapped within the observedTouchView frame.

Step 1. In viewDidLoad, apply readyToUse() method to get ready to show BSFloatListView.
Just like below.
override func viewDidLoad() {
  super.viewDidLoad()

  /**
  * Ready to use BSFloatListView
  */
  floatListView.readyToUse()
}

That's all! Just enjoy BSFloatListView! :)

Installation

BSFloatListView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'BSFloatListView'

Author

boraseoksoon@gmail.com

License

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