Skip to content

Commit e96f4f6

Browse files
committed
Release v1.0.2
1 parent ecb37fc commit e96f4f6

File tree

4 files changed

+43
-6
lines changed

4 files changed

+43
-6
lines changed

Example/Example/View Controllers/RootViewController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ class RootViewController: UITableViewController {
4242
// Create menu controller with actions
4343
let controller = PopMenuViewController(actions: [
4444
PopMenuDefaultAction(title: "Click me to", image: #imageLiteral(resourceName: "Plus"), color: .yellow),
45-
PopMenuDefaultAction(title: "Pop another menu", image: #imageLiteral(resourceName: "Heart"), color: #colorLiteral(red: 0.9816910625, green: 0.5655395389, blue: 0.4352460504, alpha: 1))
45+
PopMenuDefaultAction(title: "Pop another menu", image: #imageLiteral(resourceName: "Heart"), color: #colorLiteral(red: 0.9816910625, green: 0.5655395389, blue: 0.4352460504, alpha: 1)),
46+
PopMenuDefaultAction(title: "Try it out!", image: nil, color: .white)
4647
])
4748

4849
// Customize appearance

NewPopMenu.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'NewPopMenu'
3-
spec.version = '1.0.1'
3+
spec.version = '1.0.2'
44
spec.license = { :type => 'MIT', :file => "LICENSE" }
55
spec.homepage = 'https://github.com/CaliCastle/PopMenu'
66
spec.authors = { 'Cali Castle' => '[email protected]' }
7-
spec.summary = 'A cool and customizable menu action sheet for iOS'
8-
spec.source = { :git => 'https://github.com/CaliCastle/PopMenu.git', :tag => 'v1.0.1' }
7+
spec.summary = 'A cool and customizable popup action sheet for iOS'
8+
spec.source = { :git => 'https://github.com/CaliCastle/PopMenu.git', :tag => 'v1.0.2' }
99
spec.source_files = 'PopMenu/**/*.{h,swift}'
1010

1111
spec.platform = :ios, "9.0"

PopMenu.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

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

3637
/* Begin PBXFileReference section */
3738
8DA31A6A208134EF001498B9 /* PopMenuAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopMenuAction.swift; sourceTree = "<group>"; };
39+
9D0A90372086B2FA008A4700 /* NewPopMenu.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; fileEncoding = 4; path = NewPopMenu.podspec; sourceTree = SOURCE_ROOT; };
3840
9D397A9120802C1600C58037 /* PopMenu.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PopMenu.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3941
9D397A9420802C1600C58037 /* PopMenu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PopMenu.h; sourceTree = "<group>"; };
4042
9D397A9520802C1700C58037 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -93,6 +95,7 @@
9395
9D397A9320802C1600C58037 /* PopMenu */ = {
9496
isa = PBXGroup;
9597
children = (
98+
9D0A90372086B2FA008A4700 /* NewPopMenu.podspec */,
9699
9D397AD320805F3700C58037 /* View Controller & Views */,
97100
9D397AD220805F1800C58037 /* Classes */,
98101
9D397AD120805E8900C58037 /* Transitions */,
@@ -246,6 +249,7 @@
246249
isa = PBXResourcesBuildPhase;
247250
buildActionMask = 2147483647;
248251
files = (
252+
9D0A90382086B2FA008A4700 /* NewPopMenu.podspec in Resources */,
249253
);
250254
runOnlyForDeploymentPostprocessing = 0;
251255
};

README.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,27 @@ menu.setBarButtonItemForSourceView(yourBarButtonItem)
234234

235235
-------
236236

237-
### Action Callback
237+
### Selection Callback
238238

239-
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:
239+
In order to know which action button is tapped, there are two ways of doing that:
240+
- Action Handler
241+
- Delegate
242+
243+
### Action Handler
244+
245+
Simply pass the handler when instanstiating the action:
246+
247+
```swift
248+
let action1 = PopMenuDefaultAction(title: "Action 1", handler: { action in
249+
// action is a `PopMenuAction`, in this case it's a `PopMenuDefaultAction`
250+
251+
// Print out: 'Action 1 is tapped'
252+
print("\(action.title) is tapped")
253+
})
254+
```
255+
256+
### Delegate Method
257+
You'll need to comform to `PopMenuViewControllerDelegate` protocol and then implement the method `popMenuDidSelectItem(at index: Int)` in your view controller:
240258

241259
```swift
242260
class ViewController: UIViewController {
@@ -271,6 +289,20 @@ extension ViewController: PopMenuViewControllerDelegate {
271289

272290
}
273291
```
292+
### Dismissal Callback
293+
294+
If you'd want more control to do additional steps when the menu is dismssed, you can do it like this:
295+
296+
```swift
297+
// The manager way
298+
manager.popMenuDismissalHandler = { selected in
299+
// `selected` is a bool indicating if a selection has been made
300+
301+
if !selected {
302+
// When the user tapped outside of the menu
303+
}
304+
}
305+
```
274306

275307
That's basically it! Congrats!
276308

0 commit comments

Comments
 (0)