This PR contains all the work related to setting up this project as required to implement the [Assignment](https://repo.rock-n-code.com/rock-n-code/deep-linking-assignment/wiki/Assignment) on top, as intended. To summarise this work: - [x] created a new **Xcode** project; - [x] cloned the `Wikipedia` app and inserted it into the **Xcode** project; - [x] created the `Locations` app and also, its `Libraries` package; - [x] created the `Shared` package to share dependencies between the apps; - [x] added a `Makefile` file and implemented some **environment** and **help** commands. Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Reviewed-on: rock-n-code/deep-linking-assignment#1
32 lines
1.3 KiB
Swift
32 lines
1.3 KiB
Swift
import UIKit
|
|
|
|
extension UIViewController {
|
|
|
|
@objc func wmf_showAlertWithError(_ error: NSError) {
|
|
let alert = UIAlertController(title: error.localizedDescription, message: error.localizedRecoverySuggestion, preferredStyle: .alert)
|
|
alert.addAction(UIAlertAction(title: CommonStrings.okTitle, style:.default, handler: nil))
|
|
present(alert, animated: true, completion: nil)
|
|
}
|
|
|
|
@objc func wmf_showAlertWithMessage(_ message: String) {
|
|
let alert = UIAlertController(title: nil, message: message, preferredStyle: .alert)
|
|
alert.addAction(UIAlertAction(title: CommonStrings.okTitle, style:.default, handler: nil))
|
|
present(alert, animated: true, completion: nil)
|
|
}
|
|
|
|
@objc func wmf_showAlert(title: String?, message: String?, actions: [UIAlertAction], completion: (() -> Void)? = nil) {
|
|
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
|
|
actions.forEach { action in alert.addAction(action) }
|
|
present(alert, animated: true, completion: completion)
|
|
}
|
|
|
|
func showError(_ error: Error, sticky: Bool = false) {
|
|
WMFAlertManager.sharedInstance.showErrorAlert(error, sticky: sticky, dismissPreviousAlerts: false, viewController: self)
|
|
}
|
|
|
|
func showGenericError() {
|
|
showError(RequestError.unknown)
|
|
}
|
|
|
|
}
|