mirror of
https://github.com/ReactiveX/RxSwift.git
synced 2024-10-04 22:17:41 +03:00
Fix RxExample warnings
This commit is contained in:
parent
e5586918c6
commit
c4326d4814
@ -33,13 +33,3 @@ extension String {
|
||||
return numberFormatter.number(from: self)?.doubleValue
|
||||
}
|
||||
}
|
||||
|
||||
func showAlert(_ message: String) {
|
||||
#if os(iOS)
|
||||
UIAlertView(title: "RxExample", message: message, delegate: nil, cancelButtonTitle: "OK").show()
|
||||
#elseif os(macOS)
|
||||
let alert = NSAlert()
|
||||
alert.messageText = message
|
||||
alert.runModal()
|
||||
#endif
|
||||
}
|
||||
|
@ -83,8 +83,18 @@ class GitHubSearchRepositoriesViewController: ViewController, UITableViewDelegat
|
||||
.map { $0.isLimitExceeded }
|
||||
.distinctUntilChanged()
|
||||
.filter { $0 }
|
||||
.drive(onNext: { n in
|
||||
showAlert("Exceeded limit of 10 non authenticated requests per minute for GitHub API. Please wait a minute. :(\nhttps://developer.github.com/v3/#rate-limiting")
|
||||
.drive(onNext: { [weak self] n in
|
||||
guard let self = self else { return }
|
||||
|
||||
let message = "Exceeded limit of 10 non authenticated requests per minute for GitHub API. Please wait a minute. :(\nhttps://developer.github.com/v3/#rate-limiting"
|
||||
|
||||
#if os(iOS)
|
||||
self.present(UIAlertController(title: "RxExample", message: message, preferredStyle: .alert), animated: true)
|
||||
#elseif os(macOS)
|
||||
let alert = NSAlert()
|
||||
alert.messageText = message
|
||||
alert.runModal()
|
||||
#endif
|
||||
})
|
||||
.disposed(by: disposeBag)
|
||||
|
||||
|
@ -62,14 +62,12 @@ class SimpleValidationViewController : ViewController {
|
||||
}
|
||||
|
||||
func showAlert() {
|
||||
let alertView = UIAlertView(
|
||||
let alert = UIAlertController(
|
||||
title: "RxExample",
|
||||
message: "This is wonderful",
|
||||
delegate: nil,
|
||||
cancelButtonTitle: "OK"
|
||||
preferredStyle: .alert
|
||||
)
|
||||
|
||||
alertView.show()
|
||||
show(alert, sender: nil)
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user