Latest 1.0
Homepage https://github.com/wgywgy/SimpleActionSheet
License MIT
Platforms ios 8.0
Authors

A Simple ActionSheet writen in Swift

SimpleActionSheet
Build Status
codebeat badge
Carthage Compatible

Screenshots

Screenshots1

Install

CocoaPods

pod install 'SimpleActionSheet'

Carthage

SimpleActionSheet is also available through Carthage. Append this line to Cartfile and follow this instruction.

github "wgywgy/SimpleActionSheet"

Requirements

  • iOS 8.0+

Use

STEP1: Init a ActionSheet and ActionSheetItem.

lazy var actionSheet: ActionSheet = {
    let actionSheet = ActionSheet()
    return actionSheet
}()

lazy var actionSheetItem: [ActionSheetItemModel] = {
    let logoutActionItem = ActionSheetItem(title: "退出登录") { [weak self] (actionSheet) in
        guard let `self` = self else { return }
        self.logout()
    }

    let cancelActionItem = CancelActionSheetItem { (actionSheet) in
        print("cancel")
        actionSheet.dismiss()
    }

    return [logoutActionItem, cancelActionItem]
}()

STEP 2: Define ActionSheet in extension.

extension ActionSheet {
    class func logoutStyle() -> [ActionSheetOption] {
        let options: [ActionSheetOption] = [
            ActionSheetOption.sepLineHeight(1),
            ActionSheetOption.sepLineColor(UIColor.lightGray),
            ActionSheetOption.sepLineLeftMargin(20),
            ]
        return options
    }
}

STEP 3: Show Action as below.

actionSheet.items = actionSheetItem
actionSheet.showInWindow(options: ActionSheet.logoutStyle())

More method can look at ActionSheet.swift.

License

SimpleActionSheet is released under the MIT license. See LICENSE for details.

Latest podspec

{
    "name": "SimpleActionSheet",
    "version": "1.0",
    "summary": "A Simple ActionSheet writen in Swift",
    "description": "A Simple ActionSheet which can animate show custom sheet view.",
    "homepage": "https://github.com/wgywgy/SimpleActionSheet",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "wuguanyu": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/wgywgy/SimpleActionSheet.git",
        "tag": "1.0"
    },
    "source_files": "Source/*.swift"
}

Pin It on Pinterest

Share This