Skip to content

Commit 25915d7

Browse files
committed
Bugfixing
1 parent 5ead5c9 commit 25915d7

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

Example/LoadingViewController/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ViewController: LoadingViewController {
4141
}
4242

4343
override func loadingViewStyle() -> LoadingViewStyle {
44-
return .Stroke
44+
return .Indicator
4545
}
4646
}
4747

LoadingViewController.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'LoadingViewController'
11-
s.version = '0.1.6'
11+
s.version = '0.1.7'
1212
s.summary = 'LoadingViewController is a component for changing controller views: content -> loading -> content or content -> loading -> error.'
1313

1414
# This description is used to generate tags and improve search results.

LoadingViewController/Classes/LoadingViewController.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,14 @@ public class LoadingViewController: UIViewController {
230230
performTransitionFromView(fromView as? UIView, toView: toView! as! UIView, animated: animated! as! Bool, contentType: ContentType(rawValue: contentType! as! Int)!)
231231
}
232232

233-
private func isContentViewAvailable(checkingView: UIView) -> Bool {
233+
private func isContentViewAvailable(checkingView: UIView?) -> Bool {
234234

235235
var result = false
236+
if checkingView == nil {
237+
return result
238+
}
236239

237-
let theView = checkingView
240+
let theView = checkingView!
238241
while let theViewUnw = theView.superview {
239242
if theViewUnw == self.view { break }
240243
if theViewUnw == self.contentView {
@@ -262,19 +265,21 @@ public class LoadingViewController: UIViewController {
262265
}
263266

264267
let theFromView = fromView
268+
let theFromViewInConentView = isContentViewAvailable(theFromView)
265269
let fromViewIsContentView = (theFromView == self.contentView)
266270

267271
let theToView = toView
272+
let theToViewInContentView = isContentViewAvailable(theToView)
268273
let toViewIsContentView = (theToView == self.contentView)
269274

270275
if fromViewIsContentView && toViewIsContentView {
271276
finish()
272277
return
273278
}
274279

275-
let contentViewAlpha = (toViewIsContentView || fromViewIsContentView) ? 1.0 : 0.0
280+
let contentViewAlpha = (theToViewInContentView || toViewIsContentView) ? 1.0 : 0.0
276281
let removesFromView = !fromViewIsContentView
277-
let animatesToView = (!fromViewIsContentView || !toViewIsContentView)
282+
let animatesToView = (!theFromViewInConentView || !fromViewIsContentView)
278283
let animatesFromView = !fromViewIsContentView
279284

280285
func animations() {

0 commit comments

Comments
 (0)