Skip to content

Commit

Permalink
Release v1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
CaliCastle committed Apr 17, 2018
1 parent ecb37fc commit e96f4f6
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Example/Example/View Controllers/RootViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class RootViewController: UITableViewController {
// Create menu controller with actions
let controller = PopMenuViewController(actions: [
PopMenuDefaultAction(title: "Click me to", image: #imageLiteral(resourceName: "Plus"), color: .yellow),
PopMenuDefaultAction(title: "Pop another menu", image: #imageLiteral(resourceName: "Heart"), color: #colorLiteral(red: 0.9816910625, green: 0.5655395389, blue: 0.4352460504, alpha: 1))
PopMenuDefaultAction(title: "Pop another menu", image: #imageLiteral(resourceName: "Heart"), color: #colorLiteral(red: 0.9816910625, green: 0.5655395389, blue: 0.4352460504, alpha: 1)),
PopMenuDefaultAction(title: "Try it out!", image: nil, color: .white)
])

// Customize appearance
Expand Down
6 changes: 3 additions & 3 deletions NewPopMenu.podspec
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Pod::Spec.new do |spec|
spec.name = 'NewPopMenu'
spec.version = '1.0.1'
spec.version = '1.0.2'
spec.license = { :type => 'MIT', :file => "LICENSE" }
spec.homepage = 'https://github.com/CaliCastle/PopMenu'
spec.authors = { 'Cali Castle' => 'cali@calicastle.com' }
spec.summary = 'A cool and customizable menu action sheet for iOS'
spec.source = { :git => 'https://github.com/CaliCastle/PopMenu.git', :tag => 'v1.0.1' }
spec.summary = 'A cool and customizable popup action sheet for iOS'
spec.source = { :git => 'https://github.com/CaliCastle/PopMenu.git', :tag => 'v1.0.2' }
spec.source_files = 'PopMenu/**/*.{h,swift}'

spec.platform = :ios, "9.0"
Expand Down
4 changes: 4 additions & 0 deletions PopMenu.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/* Begin PBXBuildFile section */
8DA31A6B208134EF001498B9 /* PopMenuAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DA31A6A208134EF001498B9 /* PopMenuAction.swift */; };
9D0A90382086B2FA008A4700 /* NewPopMenu.podspec in Resources */ = {isa = PBXBuildFile; fileRef = 9D0A90372086B2FA008A4700 /* NewPopMenu.podspec */; };
9D397A9B20802C1700C58037 /* PopMenu.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D397A9120802C1600C58037 /* PopMenu.framework */; };
9D397AA020802C1700C58037 /* PopMenuTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D397A9F20802C1700C58037 /* PopMenuTests.swift */; };
9D397AA220802C1700C58037 /* PopMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D397A9420802C1600C58037 /* PopMenu.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -35,6 +36,7 @@

/* Begin PBXFileReference section */
8DA31A6A208134EF001498B9 /* PopMenuAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopMenuAction.swift; sourceTree = "<group>"; };
9D0A90372086B2FA008A4700 /* NewPopMenu.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; fileEncoding = 4; path = NewPopMenu.podspec; sourceTree = SOURCE_ROOT; };
9D397A9120802C1600C58037 /* PopMenu.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PopMenu.framework; sourceTree = BUILT_PRODUCTS_DIR; };
9D397A9420802C1600C58037 /* PopMenu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PopMenu.h; sourceTree = "<group>"; };
9D397A9520802C1700C58037 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -93,6 +95,7 @@
9D397A9320802C1600C58037 /* PopMenu */ = {
isa = PBXGroup;
children = (
9D0A90372086B2FA008A4700 /* NewPopMenu.podspec */,
9D397AD320805F3700C58037 /* View Controller & Views */,
9D397AD220805F1800C58037 /* Classes */,
9D397AD120805E8900C58037 /* Transitions */,
Expand Down Expand Up @@ -246,6 +249,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9D0A90382086B2FA008A4700 /* NewPopMenu.podspec in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,27 @@ menu.setBarButtonItemForSourceView(yourBarButtonItem)

-------

### Action Callback
### Selection Callback

In order to know which action button is tapped, you'll need to comform to `PopMenuViewControllerDelegate` protocol and then implement the method `popMenuDidSelectItem(at index: Int)` in your view controller:
In order to know which action button is tapped, there are two ways of doing that:
- Action Handler
- Delegate

### Action Handler

Simply pass the handler when instanstiating the action:

```swift
let action1 = PopMenuDefaultAction(title: "Action 1", handler: { action in
// action is a `PopMenuAction`, in this case it's a `PopMenuDefaultAction`

// Print out: 'Action 1 is tapped'
print("\(action.title) is tapped")
})
```

### Delegate Method
You'll need to comform to `PopMenuViewControllerDelegate` protocol and then implement the method `popMenuDidSelectItem(at index: Int)` in your view controller:

```swift
class ViewController: UIViewController {
Expand Down Expand Up @@ -271,6 +289,20 @@ extension ViewController: PopMenuViewControllerDelegate {

}
```
### Dismissal Callback

If you'd want more control to do additional steps when the menu is dismssed, you can do it like this:

```swift
// The manager way
manager.popMenuDismissalHandler = { selected in
// `selected` is a bool indicating if a selection has been made

if !selected {
// When the user tapped outside of the menu
}
}
```

That's basically it! Congrats!

Expand Down

0 comments on commit e96f4f6

Please sign in to comment.