Use | operator to concatenate multiline strings

This commit is contained in:
Danny Moesch 2019-01-20 12:15:54 +01:00 committed by Mingshen Sun
parent 2fdd3fd6ec
commit 08c91599b6
5 changed files with 6 additions and 6 deletions

View file

@ -357,7 +357,7 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
} catch {
Utils.alert(title: "Error".localize(), message: error.localizedDescription, controller: self, completion: nil)
}
SVProgressHUD.showSuccess(withStatus: "PasswordCopied".localize() + "\n" + "CounterUpdated".localize())
SVProgressHUD.showSuccess(withStatus: "PasswordCopied".localize() | "CounterUpdated".localize())
SVProgressHUD.dismiss(withDelay: 1)
}
}

View file

@ -64,7 +64,6 @@ class PasswordEditorTableViewController: UITableViewController, FillPasswordTabl
memorablePasswordGeneratorCell?.accessoryType = .disclosureIndicator
}
override func viewDidLoad() {
super.viewDidLoad()
if navigationItemTitle != nil {

View file

@ -176,9 +176,9 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
let error = error as NSError
var message = error.localizedDescription
if let underlyingError = error.userInfo[NSUnderlyingErrorKey] as? NSError {
message = "\(message)\n\("UnderlyingError".localize(underlyingError.localizedDescription))"
message = message | "UnderlyingError".localize(underlyingError.localizedDescription)
if underlyingError.localizedDescription.contains("WrongPassphrase".localize()) {
message = "\(message)\n\("RecoverySuggestion".localize())"
message = message | "RecoverySuggestion".localize()
gitCredential.delete()
}
}

View file

@ -10,6 +10,7 @@ import UIKit
import AVFoundation
import OneTimePassword
import SVProgressHUD
import passKit
protocol QRScannerControllerDelegate {
func checkScannedOutput(line: String) -> (accept: Bool, message: String)
@ -130,7 +131,7 @@ class QRScannerController: UIViewController, AVCaptureMetadataOutputObjectsDeleg
func presentCameraSettings() {
let alertController = UIAlertController(title: "Error".localize(),
message: "CameraAccessDenied.".localize() + "\n" + "WarningToggleCameraPermissionsResetsApp.".localize(),
message: "CameraAccessDenied.".localize() | "WarningToggleCameraPermissionsResetsApp.".localize(),
preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "Cancel".localize(), style: .default))
alertController.addAction(UIAlertAction(title: "Settings".localize(), style: .cancel) { _ in

View file

@ -23,7 +23,7 @@ public extension String {
}
extension String {
static func | (left: String, right: String) -> String {
public static func | (left: String, right: String) -> String {
return right.isEmpty ? left : left + "\n" + right
}
}