9
9
import UIKit
10
10
11
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 )
12
+ func willMove ( toMenu menuController: UIViewController , fromMenu previousMenuController: UIViewController )
13
+ func didMove ( toMenu menuController: UIViewController , fromMenu previousMenuController: UIViewController )
14
+ func willMove ( toMenuItem menuItemView: MenuItemView , fromMenuItem previousMenuItemView: MenuItemView )
15
+ func didMove ( toMenuItem menuItemView: MenuItemView , fromMenuItem previousMenuItemView: MenuItemView )
16
16
}
17
17
18
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 ) { }
19
+ func willMove ( toMenu menuController: UIViewController , fromMenu previousMenuController: UIViewController ) { }
20
+ func didMove ( toMenu menuController: UIViewController , fromMenu previousMenuController: UIViewController ) { }
21
+ func willMove ( toMenuItem menuItemView: MenuItemView , fromMenuItem previousMenuItemView: MenuItemView ) { }
22
+ func didMove ( toMenuItem menuItemView: MenuItemView , fromMenuItem previousMenuItemView: MenuItemView ) { }
23
23
}
24
24
25
25
internal let MinimumSupportedViewCount = 1
@@ -128,7 +128,7 @@ open class PagingMenuController: UIViewController, PagingValidator {
128
128
case . menuView: return
129
129
default : break
130
130
}
131
-
131
+
132
132
constructPagingViewController ( )
133
133
layoutPagingViewController ( )
134
134
}
@@ -159,14 +159,14 @@ open class PagingMenuController: UIViewController, PagingValidator {
159
159
}
160
160
161
161
guard let pagingViewController = pagingViewController,
162
- let previousViewController = pagingViewController. currentViewController else { return }
162
+ let previousPagingViewController = pagingViewController. currentViewController else { return }
163
163
164
164
// hide paging views if it's moving to far away
165
165
hidePagingMenuControllers ( page)
166
166
167
167
let nextPage = page % pagingViewController. controllers. count
168
168
let nextPagingViewController = pagingViewController. controllers [ nextPage]
169
- delegate? . willMoveToPageMenuController ( nextPagingViewController, previousMenuController : previousViewController )
169
+ delegate? . willMove ( toMenu : nextPagingViewController, fromMenu : previousPagingViewController )
170
170
menuView? . moveToMenu ( page)
171
171
172
172
pagingViewController. updateCurrentPage ( nextPage)
@@ -182,7 +182,7 @@ open class PagingMenuController: UIViewController, PagingValidator {
182
182
// show paging views
183
183
self ? . showPagingMenuControllers ( )
184
184
185
- self ? . delegate? . didMoveToPageMenuController ( nextPagingViewController, previousMenuController : previousViewController )
185
+ self ? . delegate? . didMove ( toMenu : nextPagingViewController, fromMenu : previousPagingViewController )
186
186
}
187
187
}
188
188
0 commit comments