Quellcode durchsuchen

minor cleanup to Speech sample

Tim Burks vor 9 Jahren
Ursprung
Commit
df08c709d6

+ 1 - 1
Examples/Speech/Speech/SpeechRecognitionService.swift

@@ -66,7 +66,7 @@ class SpeechRecognitionService {
           streamingRecognizeRequest.addField("streaming_config", value:streamingRecognitionConfig)
 
           let messageData = streamingRecognizeRequest.data()
-          let success = call.sendMessage(data:messageData)
+          _ = call.sendMessage(data:messageData)
           nowStreaming = true
           self.receiveMessage()
         }

+ 1 - 3
Examples/Speech/Speech/ViewController.swift

@@ -83,6 +83,7 @@ class ViewController : UIViewController, AudioControllerDelegate {
               self.textView.text = error.localizedDescription
             } else if let response = response as? Message {
               var finished = false
+              print("====== RECEIVED MESSAGE ======")
               response.display()
               response.forEachField("results") {(field) in
                 if let alternativesField = field.message().oneField("alternatives") {
@@ -92,9 +93,6 @@ class ViewController : UIViewController, AudioControllerDelegate {
                     if let _ = field.message().oneField("is_final") {
                       self.transcripts.insert(transcript.string(), at:0)
                       self.tableView.insertRows(at:[IndexPath(row:0, section:0)], with: .automatic)
-                      while(self.transcripts.count > 12) {
-                        self.transcripts.removeLast(1)
-                      }
                       self.textView.text = ""
                       finished = true
                     } else {

+ 1 - 1
Packages/gRPC/Sources/Call.swift

@@ -277,7 +277,7 @@ public class Call {
     let operations = OperationGroup(call:self, operations:[.sendInitialMetadata(metadata)])
     {(operationGroup) in
       if operationGroup.success {
-        print("call successful")
+
       } else {
         return
       }