NXMActionSheet 0.2.1

NXMActionSheet 0.2.1

Maintained by NXMActionSheetTrunk.



  • By
  • nExmond

NXMActionSheet

CI Status Version License Platform Language

Preview

demo

Requirements

Written as Swift 4 and tested on iOS 9.

Installation

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

pod 'NXMActionSheet'

Usage

import NXMActionSheet

Basic

Chaining

//add items
add(imageViewData)
.add(datas: labelViewDataList)
.insert(twoButtonData, at: 0)

Default views make it easy to show

NXMActionSheet()
            .add(.init(.image(/*image*/))))
            .add(.init(.activityIndicator(.gray)))
            .add(.init(.slider(0.5, nil)))
            .add(.init(.label("Label")))
            .add(.init(.button("Button", UIColor.brown, nil), withTouchClose: true))
            .show()

Inherit & Custom

When using inheritance, be sure to include the following functions

class CustomActionSheet : NXMActionSheet {
    
    convenience init (withType:NXMActionSheetAnimationType = .slide) {
        self.init(frame: .zero)
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
}

Create .xib and .swift with the same name and use it as follows

//ImageView
let customImageView = CustomImageView.loadView()
customImageView.imageView.image = /*image*/
let imageViewData = NXMActionSheetData(.custom(imageView))
...
add(imageViewData)

please check the example for details

Delegate

//require
func didSelectActionItem(_ actionSheet:NXMActionSheet, withData:NXMActionSheetData)

//optional
func actionSheetWillShow()
func actionSheetDidShow()
func actionSheetWillHide()
func actionSheetDidHide()
func actionSheetWillUpdate()
func actionSheetDidUpdate()

!!

If content height in UITableView is larger than UIScreen height, scrolling is enabled. However, if you set the scroll position on update, it is possible that the transition is not smooth.

Example

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

Author

nExmond, [email protected]

License

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