@@ -105,16 +105,16 @@ open class PagerTabStripViewController: UIViewController, UIScrollViewDelegate {
105
105
reloadViewControllers ( )
106
106
107
107
let childController = viewControllers [ currentIndex]
108
- addChildViewController ( childController)
108
+ addChild ( childController)
109
109
childController. view. autoresizingMask = [ . flexibleHeight, . flexibleWidth]
110
110
containerView. addSubview ( childController. view)
111
- childController. didMove ( toParentViewController : self )
111
+ childController. didMove ( toParent : self )
112
112
}
113
113
114
114
open override func viewWillAppear( _ animated: Bool ) {
115
115
super. viewWillAppear ( animated)
116
116
isViewAppearing = true
117
- childViewControllers . forEach { $0. beginAppearanceTransition ( true , animated: animated) }
117
+ children . forEach { $0. beginAppearanceTransition ( true , animated: animated) }
118
118
}
119
119
120
120
override open func viewDidAppear( _ animated: Bool ) {
@@ -126,17 +126,17 @@ open class PagerTabStripViewController: UIViewController, UIScrollViewDelegate {
126
126
moveToViewController ( at: preCurrentIndex)
127
127
}
128
128
isViewAppearing = false
129
- childViewControllers . forEach { $0. endAppearanceTransition ( ) }
129
+ children . forEach { $0. endAppearanceTransition ( ) }
130
130
}
131
131
132
132
open override func viewWillDisappear( _ animated: Bool ) {
133
133
super. viewWillDisappear ( animated)
134
- childViewControllers . forEach { $0. beginAppearanceTransition ( false , animated: animated) }
134
+ children . forEach { $0. beginAppearanceTransition ( false , animated: animated) }
135
135
}
136
136
137
137
open override func viewDidDisappear( _ animated: Bool ) {
138
138
super. viewDidDisappear ( animated)
139
- childViewControllers . forEach { $0. endAppearanceTransition ( ) }
139
+ children . forEach { $0. endAppearanceTransition ( ) }
140
140
}
141
141
142
142
override open func viewDidLayoutSubviews( ) {
@@ -240,25 +240,25 @@ open class PagerTabStripViewController: UIViewController, UIScrollViewDelegate {
240
240
241
241
for (index, childController) in pagerViewControllers. enumerated ( ) {
242
242
let pageOffsetForChild = self . pageOffsetForChild ( at: index)
243
- if fabs ( containerView. contentOffset. x - pageOffsetForChild) < containerView. bounds. width {
243
+ if abs ( containerView. contentOffset. x - pageOffsetForChild) < containerView. bounds. width {
244
244
if childController. parent != nil {
245
245
childController. view. frame = CGRect ( x: offsetForChild ( at: index) , y: 0 , width: view. bounds. width, height: containerView. bounds. height)
246
246
childController. view. autoresizingMask = [ . flexibleHeight, . flexibleWidth]
247
247
} else {
248
248
childController. beginAppearanceTransition ( true , animated: false )
249
- addChildViewController ( childController)
249
+ addChild ( childController)
250
250
childController. view. frame = CGRect ( x: offsetForChild ( at: index) , y: 0 , width: view. bounds. width, height: containerView. bounds. height)
251
251
childController. view. autoresizingMask = [ . flexibleHeight, . flexibleWidth]
252
252
containerView. addSubview ( childController. view)
253
- childController. didMove ( toParentViewController : self )
253
+ childController. didMove ( toParent : self )
254
254
childController. endAppearanceTransition ( )
255
255
}
256
256
} else {
257
257
if childController. parent != nil {
258
258
childController. beginAppearanceTransition ( false , animated: false )
259
- childController. willMove ( toParentViewController : nil )
259
+ childController. willMove ( toParent : nil )
260
260
childController. view. removeFromSuperview ( )
261
- childController. removeFromParentViewController ( )
261
+ childController. removeFromParent ( )
262
262
childController. endAppearanceTransition ( )
263
263
}
264
264
}
@@ -284,9 +284,9 @@ open class PagerTabStripViewController: UIViewController, UIScrollViewDelegate {
284
284
guard isViewLoaded else { return }
285
285
for childController in viewControllers where childController. parent != nil {
286
286
childController. beginAppearanceTransition ( false , animated: false )
287
- childController. willMove ( toParentViewController : nil )
287
+ childController. willMove ( toParent : nil )
288
288
childController. view. removeFromSuperview ( )
289
- childController. removeFromParentViewController ( )
289
+ childController. removeFromParent ( )
290
290
childController. endAppearanceTransition ( )
291
291
}
292
292
reloadViewControllers ( )
0 commit comments