@@ -230,11 +230,14 @@ public class LoadingViewController: UIViewController {
230
230
performTransitionFromView ( fromView as? UIView , toView: toView! as! UIView , animated: animated! as! Bool , contentType: ContentType ( rawValue: contentType! as! Int ) !)
231
231
}
232
232
233
- private func isContentViewAvailable( checkingView: UIView ) -> Bool {
233
+ private func isContentViewAvailable( checkingView: UIView ? ) -> Bool {
234
234
235
235
var result = false
236
+ if checkingView == nil {
237
+ return result
238
+ }
236
239
237
- let theView = checkingView
240
+ let theView = checkingView!
238
241
while let theViewUnw = theView. superview {
239
242
if theViewUnw == self . view { break }
240
243
if theViewUnw == self . contentView {
@@ -262,19 +265,21 @@ public class LoadingViewController: UIViewController {
262
265
}
263
266
264
267
let theFromView = fromView
268
+ let theFromViewInConentView = isContentViewAvailable ( theFromView)
265
269
let fromViewIsContentView = ( theFromView == self . contentView)
266
270
267
271
let theToView = toView
272
+ let theToViewInContentView = isContentViewAvailable ( theToView)
268
273
let toViewIsContentView = ( theToView == self . contentView)
269
274
270
275
if fromViewIsContentView && toViewIsContentView {
271
276
finish ( )
272
277
return
273
278
}
274
279
275
- let contentViewAlpha = ( toViewIsContentView || fromViewIsContentView ) ? 1.0 : 0.0
280
+ let contentViewAlpha = ( theToViewInContentView || toViewIsContentView ) ? 1.0 : 0.0
276
281
let removesFromView = !fromViewIsContentView
277
- let animatesToView = ( !fromViewIsContentView || !toViewIsContentView )
282
+ let animatesToView = ( !theFromViewInConentView || !fromViewIsContentView )
278
283
let animatesFromView = !fromViewIsContentView
279
284
280
285
func animations( ) {
0 commit comments