Skip to content

Commit 0981d4d

Browse files
Migrate speech to text example app to swift package manager & fix compile errors (#1402)
1 parent 555b004 commit 0981d4d

File tree

9 files changed

+179
-263
lines changed

9 files changed

+179
-263
lines changed

Examples/Google/SpeechToText/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ protos:
1313
generate:
1414
protoc \
1515
googleapis/google/cloud/speech/v1/cloud_speech.proto \
16+
googleapis/google/cloud/speech/v1/resource.proto \
1617
googleapis/google/rpc/status.proto \
1718
googleapis/google/api/client.proto \
1819
googleapis/google/api/annotations.proto \
@@ -25,9 +26,8 @@ generate:
2526
mkdir -p Sources/Generated
2627
find google/ -name \*.swift -exec cp {} Sources/Generated/ \;
2728

28-
## clean : Clean workspace and start from scratch (remove googleapis, generated swift, pods, etc.)
29+
## clean : Clean workspace and start from scratch (remove googleapis, generated swift, etc.)
2930
clean:
30-
rm -rf Pods/
3131
rm -rf googleapis/
3232
rm -rf google/
3333
rm Sources/Generated/*

Examples/Google/SpeechToText/Podfile

Lines changed: 0 additions & 10 deletions
This file was deleted.

Examples/Google/SpeechToText/Podfile.lock

Lines changed: 0 additions & 117 deletions
This file was deleted.

Examples/Google/SpeechToText/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ This project requires a Google Cloud API Key. Please [register](https://cloud.go
1818

1919
## Project Setup
2020
1. Clone the repository
21-
2. Navigate to the root directory (`Examples/Google/SpeechToText`) and run `pod install`
21+
2. Navigate to the root directory (`Examples/Google/SpeechToText`)
2222
3. Run `make protos` to pull the most recent .proto files from the googleapis repository
2323
4. run `make generate` to leverage the `protoc` plugin to generate the Swift interfaces
2424
- Note: Please refer to [Getting the `protoc` Plugins](https://github.com/grpc/grpc-swift#getting-the-protoc-plugins). For this tutorial, the Makefile requires that the `protoc-gen-grpc-swift` and `protoc-gen-swift` are on the users PATH.
25-
5. Open the `.xcworkspace`
25+
5. Open the `.xcodeproj`
2626
6. Open the `Constants.swift` file and assign your generated Google Cloud API Key to the `apiKey` variable.
2727
- Note: Once you add the API Key, feel free to remove the forced warning/reminder on line 23.
2828
7. Run the application!

Examples/Google/SpeechToText/Sources/SpeechService.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
import Foundation
1718
import GRPC
1819
import Logging
1920

@@ -50,7 +51,7 @@ final class SpeechService {
5051

5152
// Create a connection secured with TLS to Google's speech service running on our `EventLoopGroup`
5253
let channel = ClientConnection
53-
.secure(group: group)
54+
.usingPlatformAppropriateTLS(for: group)
5455
.withBackgroundActivityLogger(logger)
5556
.connect(host: "speech.googleapis.com", port: 443)
5657

0 commit comments

Comments
 (0)