Index: iOS/ShowDetailsController.swift ================================================================== --- iOS/ShowDetailsController.swift +++ iOS/ShowDetailsController.swift @@ -129,11 +129,13 @@ ShowDetailsController.clearNSMutableString(password) } } } - private func generateWithCallback(_ block: (_: NSMutableString) -> ()) { + private func generateWithCallback( + _ block: @escaping (_: NSMutableString) -> () + ) { let generator: PasswordGenerator = isLegacy ? LegacyPasswordGenerator() : NewPasswordGenerator() generator.site = name.ofObject generator.length = size_t(length) @@ -164,19 +166,20 @@ withIdentifier: "activityIndicator") navigationController?.view.addSubview(activityController.view) DispatchQueue.global(qos: .default).async { generator.derivePassword() - } - - let password = NSMutableString(bytes: generator.output.items, - length: generator.length, - encoding: String.Encoding.utf8.rawValue)! - - DispatchQueue.main.sync { - activityController.view.isHidden = true - block(password) + + let password = NSMutableString( + bytes: generator.output.items!, + length: generator.length, + encoding: String.Encoding.utf8.rawValue)! + + DispatchQueue.main.sync { + activityController.view.isHidden = true + block(password) + } } } @IBAction func remove(_ sender: Any?) { let message = "Do you want to remove this site?"