Skip to content
This repository was archived by the owner on Jun 17, 2018. It is now read-only.

Commit 3f266a9

Browse files
authored
Merge pull request #253 from Guoxweii/overwrite_PagingMenuControllerDelegate
overwrite PagingMenuControllerProtocol
2 parents dfd1918 + 3645adf commit 3f266a9

File tree

4 files changed

+45
-38
lines changed

4 files changed

+45
-38
lines changed

Example/PagingMenuControllerDemo.xcodeproj/project.pbxproj

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,13 @@
307307
isa = PBXNativeTarget;
308308
buildConfigurationList = 707C60FA1AFF822200BDAB0B /* Build configuration list for PBXNativeTarget "PagingMenuControllerDemo" */;
309309
buildPhases = (
310-
81D7254A1C3EA86418ABA06D /* 📦 Check Pods Manifest.lock */,
310+
81D7254A1C3EA86418ABA06D /* [CP] Check Pods Manifest.lock */,
311311
707C60D71AFF822100BDAB0B /* Sources */,
312312
707C60D81AFF822100BDAB0B /* Frameworks */,
313313
707C60D91AFF822100BDAB0B /* Resources */,
314314
70C505481B0058B10007571E /* Embed Frameworks */,
315-
8EBB653436FDCF3C48E9A04C /* 📦 Embed Pods Frameworks */,
316-
4912F03CF8BCA040ACEF6BB3 /* 📦 Copy Pods Resources */,
315+
8EBB653436FDCF3C48E9A04C /* [CP] Embed Pods Frameworks */,
316+
4912F03CF8BCA040ACEF6BB3 /* [CP] Copy Pods Resources */,
317317
);
318318
buildRules = (
319319
);
@@ -328,12 +328,12 @@
328328
isa = PBXNativeTarget;
329329
buildConfigurationList = 707C60FD1AFF822200BDAB0B /* Build configuration list for PBXNativeTarget "PagingMenuControllerDemoTests" */;
330330
buildPhases = (
331-
064F5A6B604DDCD41EF6E479 /* 📦 Check Pods Manifest.lock */,
331+
064F5A6B604DDCD41EF6E479 /* [CP] Check Pods Manifest.lock */,
332332
707C60EC1AFF822200BDAB0B /* Sources */,
333333
707C60ED1AFF822200BDAB0B /* Frameworks */,
334334
707C60EE1AFF822200BDAB0B /* Resources */,
335-
EE6D7E4E867A74F09D5D2603 /* 📦 Embed Pods Frameworks */,
336-
A76777B0290FC45617EB6DD0 /* 📦 Copy Pods Resources */,
335+
EE6D7E4E867A74F09D5D2603 /* [CP] Embed Pods Frameworks */,
336+
A76777B0290FC45617EB6DD0 /* [CP] Copy Pods Resources */,
337337
);
338338
buildRules = (
339339
);
@@ -349,12 +349,12 @@
349349
isa = PBXNativeTarget;
350350
buildConfigurationList = EC7BA4171B524BB4007FB8A5 /* Build configuration list for PBXNativeTarget "PagingMenuControllerDemo2" */;
351351
buildPhases = (
352-
57D5C21541759D87796E93F9 /* 📦 Check Pods Manifest.lock */,
352+
57D5C21541759D87796E93F9 /* [CP] Check Pods Manifest.lock */,
353353
EC7BA3F31B524BB4007FB8A5 /* Sources */,
354354
EC7BA3F41B524BB4007FB8A5 /* Frameworks */,
355355
EC7BA3F51B524BB4007FB8A5 /* Resources */,
356-
229F81CB8BD76DBAF1B4719F /* 📦 Embed Pods Frameworks */,
357-
DB74A7466A8710147CF4667C /* 📦 Copy Pods Resources */,
356+
229F81CB8BD76DBAF1B4719F /* [CP] Embed Pods Frameworks */,
357+
DB74A7466A8710147CF4667C /* [CP] Copy Pods Resources */,
358358
);
359359
buildRules = (
360360
);
@@ -499,134 +499,134 @@
499499
/* End PBXResourcesBuildPhase section */
500500

501501
/* Begin PBXShellScriptBuildPhase section */
502-
064F5A6B604DDCD41EF6E479 /* 📦 Check Pods Manifest.lock */ = {
502+
064F5A6B604DDCD41EF6E479 /* [CP] Check Pods Manifest.lock */ = {
503503
isa = PBXShellScriptBuildPhase;
504504
buildActionMask = 2147483647;
505505
files = (
506506
);
507507
inputPaths = (
508508
);
509-
name = "📦 Check Pods Manifest.lock";
509+
name = "[CP] Check Pods Manifest.lock";
510510
outputPaths = (
511511
);
512512
runOnlyForDeploymentPostprocessing = 0;
513513
shellPath = /bin/sh;
514514
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
515515
showEnvVarsInLog = 0;
516516
};
517-
229F81CB8BD76DBAF1B4719F /* 📦 Embed Pods Frameworks */ = {
517+
229F81CB8BD76DBAF1B4719F /* [CP] Embed Pods Frameworks */ = {
518518
isa = PBXShellScriptBuildPhase;
519519
buildActionMask = 2147483647;
520520
files = (
521521
);
522522
inputPaths = (
523523
);
524-
name = "📦 Embed Pods Frameworks";
524+
name = "[CP] Embed Pods Frameworks";
525525
outputPaths = (
526526
);
527527
runOnlyForDeploymentPostprocessing = 0;
528528
shellPath = /bin/sh;
529529
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PagingMenuControllerDemo2/Pods-PagingMenuControllerDemo2-frameworks.sh\"\n";
530530
showEnvVarsInLog = 0;
531531
};
532-
4912F03CF8BCA040ACEF6BB3 /* 📦 Copy Pods Resources */ = {
532+
4912F03CF8BCA040ACEF6BB3 /* [CP] Copy Pods Resources */ = {
533533
isa = PBXShellScriptBuildPhase;
534534
buildActionMask = 2147483647;
535535
files = (
536536
);
537537
inputPaths = (
538538
);
539-
name = "📦 Copy Pods Resources";
539+
name = "[CP] Copy Pods Resources";
540540
outputPaths = (
541541
);
542542
runOnlyForDeploymentPostprocessing = 0;
543543
shellPath = /bin/sh;
544544
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PagingMenuControllerDemo/Pods-PagingMenuControllerDemo-resources.sh\"\n";
545545
showEnvVarsInLog = 0;
546546
};
547-
57D5C21541759D87796E93F9 /* 📦 Check Pods Manifest.lock */ = {
547+
57D5C21541759D87796E93F9 /* [CP] Check Pods Manifest.lock */ = {
548548
isa = PBXShellScriptBuildPhase;
549549
buildActionMask = 2147483647;
550550
files = (
551551
);
552552
inputPaths = (
553553
);
554-
name = "📦 Check Pods Manifest.lock";
554+
name = "[CP] Check Pods Manifest.lock";
555555
outputPaths = (
556556
);
557557
runOnlyForDeploymentPostprocessing = 0;
558558
shellPath = /bin/sh;
559559
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
560560
showEnvVarsInLog = 0;
561561
};
562-
81D7254A1C3EA86418ABA06D /* 📦 Check Pods Manifest.lock */ = {
562+
81D7254A1C3EA86418ABA06D /* [CP] Check Pods Manifest.lock */ = {
563563
isa = PBXShellScriptBuildPhase;
564564
buildActionMask = 2147483647;
565565
files = (
566566
);
567567
inputPaths = (
568568
);
569-
name = "📦 Check Pods Manifest.lock";
569+
name = "[CP] Check Pods Manifest.lock";
570570
outputPaths = (
571571
);
572572
runOnlyForDeploymentPostprocessing = 0;
573573
shellPath = /bin/sh;
574574
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
575575
showEnvVarsInLog = 0;
576576
};
577-
8EBB653436FDCF3C48E9A04C /* 📦 Embed Pods Frameworks */ = {
577+
8EBB653436FDCF3C48E9A04C /* [CP] Embed Pods Frameworks */ = {
578578
isa = PBXShellScriptBuildPhase;
579579
buildActionMask = 2147483647;
580580
files = (
581581
);
582582
inputPaths = (
583583
);
584-
name = "📦 Embed Pods Frameworks";
584+
name = "[CP] Embed Pods Frameworks";
585585
outputPaths = (
586586
);
587587
runOnlyForDeploymentPostprocessing = 0;
588588
shellPath = /bin/sh;
589589
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PagingMenuControllerDemo/Pods-PagingMenuControllerDemo-frameworks.sh\"\n";
590590
showEnvVarsInLog = 0;
591591
};
592-
A76777B0290FC45617EB6DD0 /* 📦 Copy Pods Resources */ = {
592+
A76777B0290FC45617EB6DD0 /* [CP] Copy Pods Resources */ = {
593593
isa = PBXShellScriptBuildPhase;
594594
buildActionMask = 2147483647;
595595
files = (
596596
);
597597
inputPaths = (
598598
);
599-
name = "📦 Copy Pods Resources";
599+
name = "[CP] Copy Pods Resources";
600600
outputPaths = (
601601
);
602602
runOnlyForDeploymentPostprocessing = 0;
603603
shellPath = /bin/sh;
604604
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PagingMenuControllerDemoTests/Pods-PagingMenuControllerDemoTests-resources.sh\"\n";
605605
showEnvVarsInLog = 0;
606606
};
607-
DB74A7466A8710147CF4667C /* 📦 Copy Pods Resources */ = {
607+
DB74A7466A8710147CF4667C /* [CP] Copy Pods Resources */ = {
608608
isa = PBXShellScriptBuildPhase;
609609
buildActionMask = 2147483647;
610610
files = (
611611
);
612612
inputPaths = (
613613
);
614-
name = "📦 Copy Pods Resources";
614+
name = "[CP] Copy Pods Resources";
615615
outputPaths = (
616616
);
617617
runOnlyForDeploymentPostprocessing = 0;
618618
shellPath = /bin/sh;
619619
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PagingMenuControllerDemo2/Pods-PagingMenuControllerDemo2-resources.sh\"\n";
620620
showEnvVarsInLog = 0;
621621
};
622-
EE6D7E4E867A74F09D5D2603 /* 📦 Embed Pods Frameworks */ = {
622+
EE6D7E4E867A74F09D5D2603 /* [CP] Embed Pods Frameworks */ = {
623623
isa = PBXShellScriptBuildPhase;
624624
buildActionMask = 2147483647;
625625
files = (
626626
);
627627
inputPaths = (
628628
);
629-
name = "📦 Embed Pods Frameworks";
629+
name = "[CP] Embed Pods Frameworks";
630630
outputPaths = (
631631
);
632632
runOnlyForDeploymentPostprocessing = 0;

Example/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ DEPENDENCIES:
66

77
EXTERNAL SOURCES:
88
PagingMenuController:
9-
:path: ../
9+
:path: "../"
1010

1111
SPEC CHECKSUMS:
1212
PagingMenuController: a47a9669760b95f630cc3ef28bdce104f9107d14
1313

1414
PODFILE CHECKSUM: 182e65100ed4f1fc8683837abd55ef28346367f5
1515

16-
COCOAPODS: 1.0.0
16+
COCOAPODS: 1.0.1

Pod/Classes/MenuView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public class MenuView: UIScrollView {
108108
let previousMenuItemView = currentMenuItemView
109109

110110
if let previousMenuItemView = previousMenuItemView where page != previousPage {
111-
viewDelegate?.willMoveToMenuItemView?(menuItemView, previousMenuItemView: previousMenuItemView)
111+
viewDelegate?.willMoveToMenuItemView(menuItemView, previousMenuItemView: previousMenuItemView)
112112
}
113113

114114
updateCurrentPage(page)
@@ -138,7 +138,7 @@ public class MenuView: UIScrollView {
138138
}
139139

140140
if let previousMenuItemView = previousMenuItemView where page != previousPage {
141-
self!.viewDelegate?.didMoveToMenuItemView?(self!.currentMenuItemView, previousMenuItemView: previousMenuItemView)
141+
self!.viewDelegate?.didMoveToMenuItemView(self!.currentMenuItemView, previousMenuItemView: previousMenuItemView)
142142
}
143143
}
144144
}

Pod/Classes/PagingMenuController.swift

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@
88

99
import UIKit
1010

11-
@objc public protocol PagingMenuControllerDelegate: class {
12-
optional func willMoveToPageMenuController(menuController: UIViewController, previousMenuController: UIViewController)
13-
optional func didMoveToPageMenuController(menuController: UIViewController, previousMenuController: UIViewController)
14-
optional func willMoveToMenuItemView(menuItemView: MenuItemView, previousMenuItemView: MenuItemView)
15-
optional func didMoveToMenuItemView(menuItemView: MenuItemView, previousMenuItemView: MenuItemView)
11+
public protocol PagingMenuControllerDelegate: class {
12+
func willMoveToPageMenuController(menuController: UIViewController, previousMenuController: UIViewController)
13+
func didMoveToPageMenuController(menuController: UIViewController, previousMenuController: UIViewController)
14+
func willMoveToMenuItemView(menuItemView: MenuItemView, previousMenuItemView: MenuItemView)
15+
func didMoveToMenuItemView(menuItemView: MenuItemView, previousMenuItemView: MenuItemView)
16+
}
17+
18+
public extension PagingMenuControllerDelegate {
19+
func willMoveToPageMenuController(menuController: UIViewController, previousMenuController: UIViewController) {}
20+
func didMoveToPageMenuController(menuController: UIViewController, previousMenuController: UIViewController) {}
21+
func willMoveToMenuItemView(menuItemView: MenuItemView, previousMenuItemView: MenuItemView) {}
22+
func didMoveToMenuItemView(menuItemView: MenuItemView, previousMenuItemView: MenuItemView) {}
1623
}
1724

1825
internal let MinimumSupportedViewCount = 1
@@ -160,7 +167,7 @@ public class PagingMenuController: UIViewController, PagingValidator {
160167

161168
let nextPage = page % pagingViewController.controllers.count
162169
let nextPagingViewController = pagingViewController.controllers[nextPage]
163-
delegate?.willMoveToPageMenuController?(nextPagingViewController, previousMenuController: previousViewController)
170+
delegate?.willMoveToPageMenuController(nextPagingViewController, previousMenuController: previousViewController)
164171
menuView?.moveToMenu(page)
165172

166173
pagingViewController.updateCurrentPage(nextPage)
@@ -176,7 +183,7 @@ public class PagingMenuController: UIViewController, PagingValidator {
176183
// show paging views
177184
self?.showPagingMenuControllers()
178185

179-
self?.delegate?.didMoveToPageMenuController?(nextPagingViewController, previousMenuController: previousViewController)
186+
self?.delegate?.didMoveToPageMenuController(nextPagingViewController, previousMenuController: previousViewController)
180187
}
181188
}
182189

0 commit comments

Comments
 (0)