Skip to content

Commit 66ffbbb

Browse files
committed
Custom errortext added
1 parent e936478 commit 66ffbbb

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

Example/LoadingViewController/ViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class ViewController: LoadingViewController {
2020
self?.setVisibleScreen(.Loading)
2121
self?.delay(3, closure: { [weak self] in
2222
self?.noDataMessage = "You don't have any search results. Please, refine your search criteria and try again."
23+
self?.customErrorTitle = "Hello World!"
2324
self?.setVisibleScreen(.Failure, actionHandler: {
2425

2526
})

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.9'
11+
s.version = '0.2.0'
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: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,17 @@ public class LoadingViewController: UIViewController {
5656
var animationQueue = Array<AnimationDict>()
5757
var currentAnimation: AnimationDict?
5858

59+
public var customErrorTitle: String?
60+
public var customErrorMessage: String?
61+
5962
public var errorTitle: String {
6063
get {
61-
return lastError?.localizedDescription ?? NSLocalizedString("Oops, something went wrong", comment: "")
64+
return lastError?.localizedDescription ?? customErrorTitle ?? NSLocalizedString("Oops, something went wrong", comment: "")
6265
}
6366
}
6467
public var errorMessage: String {
6568
get {
66-
return lastError?.localizedFailureReason ?? NSLocalizedString("Please try again later", comment: "")
69+
return lastError?.localizedFailureReason ?? customErrorMessage ?? NSLocalizedString("Please try again later", comment: "")
6770
}
6871
}
6972
public var errorIcon: UIImage?

0 commit comments

Comments
 (0)