-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Singleton Only Presenter. Allow multiple presenters. #299
Conversation
…at wants to be Viewable, Removed ActivityIndicatorPresenter singleton only Presenter. Allowed Block UI to be attached to any view.
} | ||
|
||
/** | ||
Remove UI blocker. | ||
|
||
- parameter fadeOutAnimation: fade out animation. | ||
*/ | ||
func stopAnimating(_ fadeOutAnimation: FadeOutAnimation? = NVActivityIndicatorView.DEFAULT_FADE_OUT_ANIMATION) { | ||
NVActivityIndicatorPresenter.sharedInstance.stopAnimating(fadeOutAnimation) | ||
func hideActivityIndicator(_ fadeOutAnimation: FadeOutAnimation? = NVActivityIndicatorView.DEFAULT_FADE_OUT_ANIMATION) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line Length Violation: Line should be 120 characters or less: currently 124 characters (line_length)
- parameter size: Information used to display UIBlocker | ||
- parameter fadeInAnimation: fade in animation. | ||
*/ | ||
func showActivityIndicator(activityData: ActivityData, fadeInAnimation: FadeInAnimation? = NVActivityIndicatorView.DEFAULT_FADE_IN_ANIMATION) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line Length Violation: Line should be 120 characters or less: currently 147 characters (line_length)
let leadingConstraint = NSLayoutConstraint(item: presentingView, attribute: .leading, relatedBy: .equal, toItem: containerView, attribute: .leading, multiplier: 1, constant: 0) | ||
let trailingConstraint = NSLayoutConstraint(item: presentingView, attribute: .trailing, relatedBy: .equal, toItem: containerView, attribute: .trailing, multiplier: 1, constant: 0) | ||
let topConstraint = NSLayoutConstraint(item: presentingView, attribute: .top, relatedBy: .equal, toItem: containerView, attribute: .top, multiplier: 1, constant: 0) | ||
let bottomConstraint = NSLayoutConstraint(item: presentingView, attribute: .bottom, relatedBy: .equal, toItem: containerView, attribute: .bottom, multiplier: 1, constant: 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line Length Violation: Line should be 120 characters or less: currently 185 characters (line_length)
}()) | ||
let leadingConstraint = NSLayoutConstraint(item: presentingView, attribute: .leading, relatedBy: .equal, toItem: containerView, attribute: .leading, multiplier: 1, constant: 0) | ||
let trailingConstraint = NSLayoutConstraint(item: presentingView, attribute: .trailing, relatedBy: .equal, toItem: containerView, attribute: .trailing, multiplier: 1, constant: 0) | ||
let topConstraint = NSLayoutConstraint(item: presentingView, attribute: .top, relatedBy: .equal, toItem: containerView, attribute: .top, multiplier: 1, constant: 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line Length Violation: Line should be 120 characters or less: currently 176 characters (line_length)
keyWindow.addConstraints([leadingConstraint, trailingConstraint, topConstraint, bottomConstraint]) | ||
}()) | ||
let leadingConstraint = NSLayoutConstraint(item: presentingView, attribute: .leading, relatedBy: .equal, toItem: containerView, attribute: .leading, multiplier: 1, constant: 0) | ||
let trailingConstraint = NSLayoutConstraint(item: presentingView, attribute: .trailing, relatedBy: .equal, toItem: containerView, attribute: .trailing, multiplier: 1, constant: 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line Length Violation: Line should be 120 characters or less: currently 191 characters (line_length)
|
||
keyWindow.addConstraints([leadingConstraint, trailingConstraint, topConstraint, bottomConstraint]) | ||
}()) | ||
let leadingConstraint = NSLayoutConstraint(item: presentingView, attribute: .leading, relatedBy: .equal, toItem: containerView, attribute: .leading, multiplier: 1, constant: 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line Length Violation: Line should be 120 characters or less: currently 188 characters (line_length)
guard let presentingView = self.presentingView ?? UIApplication.shared.keyWindow else { return } | ||
let containerViewFrame = self.presentingView?.bounds ?? UIScreen.main.bounds | ||
let containerView = UIView(frame: containerViewFrame) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
Vertical Whitespace Violation: Limit vertical whitespace to a single empty line. Currently 2. (vertical_whitespace)
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
} else { | ||
item.removeFromSuperview() | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
…atorView # Conflicts: # Sources/Extended/NVActivityIndicatorViewable.swift
guard let presentingView = self.presentingView ?? UIApplication.shared.keyWindow else { return } | ||
let containerViewFrame = self.presentingView?.bounds ?? UIScreen.main.bounds | ||
let containerView = UIView(frame: containerViewFrame) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines should not have trailing whitespace.
} else { | ||
item.removeFromSuperview() | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines should not have trailing whitespace.
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines should not have trailing whitespace.
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines should not have trailing whitespace.
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Limit vertical whitespace to a single empty line. Currently 2.
Code Climate has analyzed commit 43fa684 and detected 5 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
Thanks for your PR. |
NVActivityIndicatorViewable worked differently than I had assumed, and felt ineffective.
I assumed it would automatically just block the View Controllers View, instead of just using the singleton blocker.
Opening up NVActivityIndicatorPresenter will allow more flexibility. Allowing anything to have a presenter, and allowing that presenter to specify the view it should attach to will give a lot more approaches to using this library.
In My case, I want to block the View for a view controller while loading, but do not want to prevent actions on the tab bar and the navigation controller.
There are times I want to block a specific view, while keeping the rest of the view operable (such as blocking a CollectionView while keeping other UI components functional.