From d72ada9fff72eeb07cc6750c9212d7ba8745562a Mon Sep 17 00:00:00 2001 From: Fumiya Yamanaka Date: Thu, 13 Nov 2025 16:02:46 +0900 Subject: [PATCH 1/7] Fix Route Guide tutorial: make loadFeatures an instance method --- .../Resources/route-guide-sec05-step04-load-features.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step04-load-features.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step04-load-features.swift index 82dc23b9..628c00e2 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step04-load-features.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec05-step04-load-features.swift @@ -12,7 +12,7 @@ struct RouteGuide: AsyncParsableCommand { } } - private static func loadFeatures() throws -> [Routeguide_Feature] { + func loadFeatures() throws -> [Routeguide_Feature] { guard let url = Bundle.module.url(forResource: "route_guide_db", withExtension: "json") else { throw ExitCode.failure } From c278fdbe80ebfbe70545b32512c1f95e0a34d379 Mon Sep 17 00:00:00 2001 From: Fumiya Yamanaka Date: Thu, 13 Nov 2025 16:16:18 +0900 Subject: [PATCH 2/7] ix Route Guide tutorial: access request properties directly Remove .message accessor from request.latitude and request.longitude across unary, server streaming, and client streaming examples. --- .../Resources/route-guide-sec04-step04-unary.swift | 4 ++-- .../Resources/route-guide-sec04-step05-unary.swift | 8 ++++---- .../route-guide-sec04-step06-server-streaming.swift | 8 ++++---- .../route-guide-sec04-step08-client-streaming.swift | 8 ++++---- .../route-guide-sec04-step09-bidi-streaming.swift | 8 ++++---- .../route-guide-sec04-step10-bidi-streaming.swift | 8 ++++---- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step04-unary.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step04-unary.swift index 75a19a7e..2779b3dd 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step04-unary.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step04-unary.swift @@ -22,8 +22,8 @@ struct RouteGuideService: Routeguide_RouteGuide.SimpleServiceProtocol { context: ServerContext ) async throws -> Routeguide_Feature { let feature = self.findFeature( - latitude: request.message.latitude, - longitude: request.message.longitude + latitude: request.latitude, + longitude: request.longitude ) } diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step05-unary.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step05-unary.swift index d23cc14e..561725fb 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step05-unary.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step05-unary.swift @@ -22,8 +22,8 @@ struct RouteGuideService: Routeguide_RouteGuide.SimpleServiceProtocol { context: ServerContext ) async throws -> Routeguide_Feature { let feature = self.findFeature( - latitude: request.message.latitude, - longitude: request.message.longitude + latitude: request.latitude, + longitude: request.longitude ) if let feature { @@ -33,8 +33,8 @@ struct RouteGuideService: Routeguide_RouteGuide.SimpleServiceProtocol { let unknownFeature = Routeguide_Feature.with { $0.name = "" $0.location = .with { - $0.latitude = request.message.latitude - $0.longitude = request.message.longitude + $0.latitude = request.latitude + $0.longitude = request.longitude } } return unknownFeature diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step06-server-streaming.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step06-server-streaming.swift index c912c5f5..68a6ace0 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step06-server-streaming.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step06-server-streaming.swift @@ -22,8 +22,8 @@ struct RouteGuideService: Routeguide_RouteGuide.SimpleServiceProtocol { context: ServerContext ) async throws -> Routeguide_Feature { let feature = self.findFeature( - latitude: request.message.latitude, - longitude: request.message.longitude + latitude: request.latitude, + longitude: request.longitude ) if let feature { @@ -33,8 +33,8 @@ struct RouteGuideService: Routeguide_RouteGuide.SimpleServiceProtocol { let unknownFeature = Routeguide_Feature.with { $0.name = "" $0.location = .with { - $0.latitude = request.message.latitude - $0.longitude = request.message.longitude + $0.latitude = request.latitude + $0.longitude = request.longitude } } return unknownFeature diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step08-client-streaming.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step08-client-streaming.swift index 72032cfb..db211514 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step08-client-streaming.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step08-client-streaming.swift @@ -23,8 +23,8 @@ struct RouteGuideService: Routeguide_RouteGuide.SimpleServiceProtocol { context: ServerContext ) async throws -> Routeguide_Feature { let feature = self.findFeature( - latitude: request.message.latitude, - longitude: request.message.longitude + latitude: request.latitude, + longitude: request.longitude ) if let feature { @@ -34,8 +34,8 @@ struct RouteGuideService: Routeguide_RouteGuide.SimpleServiceProtocol { let unknownFeature = Routeguide_Feature.with { $0.name = "" $0.location = .with { - $0.latitude = request.message.latitude - $0.longitude = request.message.longitude + $0.latitude = request.latitude + $0.longitude = request.longitude } } return unknownFeature diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step09-bidi-streaming.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step09-bidi-streaming.swift index 96ecea32..b67f418e 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step09-bidi-streaming.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step09-bidi-streaming.swift @@ -24,8 +24,8 @@ struct RouteGuideService: Routeguide_RouteGuide.SimpleServiceProtocol { context: ServerContext ) async throws -> Routeguide_Feature { let feature = self.findFeature( - latitude: request.message.latitude, - longitude: request.message.longitude + latitude: request.latitude, + longitude: request.longitude ) if let feature { @@ -35,8 +35,8 @@ struct RouteGuideService: Routeguide_RouteGuide.SimpleServiceProtocol { let unknownFeature = Routeguide_Feature.with { $0.name = "" $0.location = .with { - $0.latitude = request.message.latitude - $0.longitude = request.message.longitude + $0.latitude = request.latitude + $0.longitude = request.longitude } } return unknownFeature diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step10-bidi-streaming.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step10-bidi-streaming.swift index 452e1ad7..68e6a366 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step10-bidi-streaming.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step10-bidi-streaming.swift @@ -24,8 +24,8 @@ struct RouteGuideService: Routeguide_RouteGuide.SimpleServiceProtocol { context: ServerContext ) async throws -> Routeguide_Feature { let feature = self.findFeature( - latitude: request.message.latitude, - longitude: request.message.longitude + latitude: request.latitude, + longitude: request.longitude ) if let feature { @@ -35,8 +35,8 @@ struct RouteGuideService: Routeguide_RouteGuide.SimpleServiceProtocol { let unknownFeature = Routeguide_Feature.with { $0.name = "" $0.location = .with { - $0.latitude = request.message.latitude - $0.longitude = request.message.longitude + $0.latitude = request.latitude + $0.longitude = request.longitude } } return unknownFeature From 9bf1a7ddadc62fa166e853bf8a02adc6366e2ac1 Mon Sep 17 00:00:00 2001 From: Fumiya Yamanaka Date: Thu, 13 Nov 2025 16:26:11 +0900 Subject: [PATCH 3/7] Add missing Notes class implementation in Route Guide tutorial Motivation: The Notes class was referenced but not implemented in the Route Guide tutorial step 10. This adds the missing thread-safe Notes class that stores RouteNote messages. Modifications: - Added Notes class with Mutex for thread-safe storage of RouteNote messages - Added recordNote method to store notes and return notes from the same location - Added receivedNotes property to RouteGuideService Result: The Notes class is now properly implemented, allowing the routeChat method to store and retrieve notes in a thread-safe manner. --- ...te-guide-sec04-step10-bidi-streaming.swift | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step10-bidi-streaming.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step10-bidi-streaming.swift index 68e6a366..4d3b66c2 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step10-bidi-streaming.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step10-bidi-streaming.swift @@ -6,10 +6,40 @@ struct RouteGuideService: Routeguide_RouteGuide.SimpleServiceProtocol { /// Known features. private let features: [Routeguide_Feature] + /// Notes recorded by clients. + private let receivedNotes: Notes + + /// A thread-safe store for notes sent by clients. + private final class Notes: Sendable { + private let notes: Mutex<[Routeguide_RouteNote]> + + init() { + self.notes = Mutex([]) + } + + /// Records a note and returns all other notes recorded at the same location. + /// + /// - Parameter receivedNote: A note to record. + /// - Returns: Other notes recorded at the same location. + func recordNote(_ receivedNote: Routeguide_RouteNote) -> [Routeguide_RouteNote] { + return self.notes.withLock { notes in + var notesFromSameLocation: [Routeguide_RouteNote] = [] + for note in notes { + if note.location == receivedNote.location { + notesFromSameLocation.append(note) + } + } + notes.append(receivedNote) + return notesFromSameLocation + } + } + } + /// Creates a new route guide service. /// - Parameter features: Known features. init(features: [Routeguide_Feature]) { self.features = features + self.receivedNotes = Notes() } /// Returns the first feature found at the given location, if one exists. From a5a13df259a49810e27cad3b86e38d2fd071a895 Mon Sep 17 00:00:00 2001 From: Fumiya Yamanaka Date: Thu, 13 Nov 2025 16:28:57 +0900 Subject: [PATCH 4/7] Fix Route Guide tutorial step numbering Step 7 was skipped in the original sequence. This fixes the step numbering to be sequential without gaps. --- ...guide-sec04-step07-client-streaming.swift} | 0 ...e-guide-sec04-step08-bidi-streaming.swift} | 34 ------------------- ...te-guide-sec04-step09-bidi-streaming.swift | 34 +++++++++++++++++++ .../Route-Guide/Route-Guide.tutorial | 6 ++-- 4 files changed, 37 insertions(+), 37 deletions(-) rename Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/{route-guide-sec04-step08-client-streaming.swift => route-guide-sec04-step07-client-streaming.swift} (100%) rename Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/{route-guide-sec04-step10-bidi-streaming.swift => route-guide-sec04-step08-bidi-streaming.swift} (81%) diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step08-client-streaming.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step07-client-streaming.swift similarity index 100% rename from Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step08-client-streaming.swift rename to Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step07-client-streaming.swift diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step10-bidi-streaming.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step08-bidi-streaming.swift similarity index 81% rename from Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step10-bidi-streaming.swift rename to Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step08-bidi-streaming.swift index 4d3b66c2..b67f418e 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step10-bidi-streaming.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step08-bidi-streaming.swift @@ -6,40 +6,10 @@ struct RouteGuideService: Routeguide_RouteGuide.SimpleServiceProtocol { /// Known features. private let features: [Routeguide_Feature] - /// Notes recorded by clients. - private let receivedNotes: Notes - - /// A thread-safe store for notes sent by clients. - private final class Notes: Sendable { - private let notes: Mutex<[Routeguide_RouteNote]> - - init() { - self.notes = Mutex([]) - } - - /// Records a note and returns all other notes recorded at the same location. - /// - /// - Parameter receivedNote: A note to record. - /// - Returns: Other notes recorded at the same location. - func recordNote(_ receivedNote: Routeguide_RouteNote) -> [Routeguide_RouteNote] { - return self.notes.withLock { notes in - var notesFromSameLocation: [Routeguide_RouteNote] = [] - for note in notes { - if note.location == receivedNote.location { - notesFromSameLocation.append(note) - } - } - notes.append(receivedNote) - return notesFromSameLocation - } - } - } - /// Creates a new route guide service. /// - Parameter features: Known features. init(features: [Routeguide_Feature]) { self.features = features - self.receivedNotes = Notes() } /// Returns the first feature found at the given location, if one exists. @@ -125,10 +95,6 @@ struct RouteGuideService: Routeguide_RouteGuide.SimpleServiceProtocol { response: RPCWriter, context: ServerContext ) async throws { - for try await note in request { - let notes = self.receivedNotes.recordNote(note) - try await response.write(contentsOf: notes) - } } } diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step09-bidi-streaming.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step09-bidi-streaming.swift index b67f418e..4d3b66c2 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step09-bidi-streaming.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec04-step09-bidi-streaming.swift @@ -6,10 +6,40 @@ struct RouteGuideService: Routeguide_RouteGuide.SimpleServiceProtocol { /// Known features. private let features: [Routeguide_Feature] + /// Notes recorded by clients. + private let receivedNotes: Notes + + /// A thread-safe store for notes sent by clients. + private final class Notes: Sendable { + private let notes: Mutex<[Routeguide_RouteNote]> + + init() { + self.notes = Mutex([]) + } + + /// Records a note and returns all other notes recorded at the same location. + /// + /// - Parameter receivedNote: A note to record. + /// - Returns: Other notes recorded at the same location. + func recordNote(_ receivedNote: Routeguide_RouteNote) -> [Routeguide_RouteNote] { + return self.notes.withLock { notes in + var notesFromSameLocation: [Routeguide_RouteNote] = [] + for note in notes { + if note.location == receivedNote.location { + notesFromSameLocation.append(note) + } + } + notes.append(receivedNote) + return notesFromSameLocation + } + } + } + /// Creates a new route guide service. /// - Parameter features: Known features. init(features: [Routeguide_Feature]) { self.features = features + self.receivedNotes = Notes() } /// Returns the first feature found at the given location, if one exists. @@ -95,6 +125,10 @@ struct RouteGuideService: Routeguide_RouteGuide.SimpleServiceProtocol { response: RPCWriter, context: ServerContext ) async throws { + for try await note in request { + let notes = self.receivedNotes.recordNote(note) + try await response.write(contentsOf: notes) + } } } diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Route-Guide.tutorial b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Route-Guide.tutorial index 63f6b7e4..839a2485 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Route-Guide.tutorial +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Route-Guide.tutorial @@ -291,7 +291,7 @@ After the *client* has finished sending points we populate a `Routeguide_RouteSummary` which we return in the response. - @Code(name: "Sources/RouteGuideService.swift", file: "route-guide-sec04-step08-client-streaming.swift") + @Code(name: "Sources/RouteGuideService.swift", file: "route-guide-sec04-step07-client-streaming.swift") } @Step { @@ -300,7 +300,7 @@ also need to modify the state of our service to store notes sent by the client. We'll do this with a helper class to store the notes. - @Code(name: "Sources/RouteGuideService.swift", file: "route-guide-sec04-step09-bidi-streaming.swift") + @Code(name: "Sources/RouteGuideService.swift", file: "route-guide-sec04-step08-bidi-streaming.swift") } @Step { @@ -308,7 +308,7 @@ note and get all other notes recorded in the same location. We then write each of those notes back to the client. - @Code(name: "Sources/RouteGuideService.swift", file: "route-guide-sec04-step10-bidi-streaming.swift") + @Code(name: "Sources/RouteGuideService.swift", file: "route-guide-sec04-step09-bidi-streaming.swift") } } } From 46f1674f8daaf3575031a19e5d2d3c5451b7c2b0 Mon Sep 17 00:00:00 2001 From: Fumiya Yamanaka Date: Thu, 13 Nov 2025 16:52:29 +0900 Subject: [PATCH 5/7] docs: Use ClientProtocol in Route Guide tutorial (fix compilation) Client is generic and cannot be used directly in method signatures. Use ClientProtocol instead to fix compilation errors in tutorial examples. --- .../Resources/route-guide-sec06-step06-get-feature.swift | 2 +- .../route-guide-sec06-step07-list-features.swift | 4 ++-- .../Resources/route-guide-sec06-step08-record-route.swift | 6 +++--- .../Resources/route-guide-sec06-step09-route-chat.swift | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step06-get-feature.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step06-get-feature.swift index e985f818..9568a9e9 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step06-get-feature.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step06-get-feature.swift @@ -14,7 +14,7 @@ extension RouteGuide { } } - private func getFeature(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func getFeature(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { print("→ Calling 'GetFeature'") let point = Routeguide_Point.with { diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step07-list-features.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step07-list-features.swift index ba990eed..0e1276eb 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step07-list-features.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step07-list-features.swift @@ -15,7 +15,7 @@ extension RouteGuide { } } - private func getFeature(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func getFeature(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { print("→ Calling 'GetFeature'") let point = Routeguide_Point.with { @@ -27,7 +27,7 @@ extension RouteGuide { print("Got feature '\(feature.name)'") } - private func listFeatures(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func listFeatures(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { print("→ Calling 'ListFeatures'") let boundingRectangle = Routeguide_Rectangle.with { diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step08-record-route.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step08-record-route.swift index 8bf4f71e..a6d97382 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step08-record-route.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step08-record-route.swift @@ -16,7 +16,7 @@ extension RouteGuide { } } - private func getFeature(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func getFeature(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { print("→ Calling 'GetFeature'") let point = Routeguide_Point.with { @@ -28,7 +28,7 @@ extension RouteGuide { print("Got feature '\(feature.name)'") } - private func listFeatures(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func listFeatures(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { print("→ Calling 'ListFeatures'") let boundingRectangle = Routeguide_Rectangle.with { @@ -51,7 +51,7 @@ extension RouteGuide { } } - private func recordRoute(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func recordRoute(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { print("→ Calling 'RecordRoute'") let features = try self.loadFeatures() diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step09-route-chat.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step09-route-chat.swift index 81d7cfac..d72503ed 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step09-route-chat.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step09-route-chat.swift @@ -17,7 +17,7 @@ extension RouteGuide { } } - private func getFeature(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func getFeature(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { print("→ Calling 'GetFeature'") let point = Routeguide_Point.with { @@ -29,7 +29,7 @@ extension RouteGuide { print("Got feature '\(feature.name)'") } - private func listFeatures(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func listFeatures(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { print("→ Calling 'ListFeatures'") let boundingRectangle = Routeguide_Rectangle.with { @@ -52,7 +52,7 @@ extension RouteGuide { } } - private func recordRoute(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func recordRoute(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { print("→ Calling 'RecordRoute'") let features = try self.loadFeatures() @@ -74,7 +74,7 @@ extension RouteGuide { ) } - private func routeChat(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func routeChat(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { print("→ Calling 'RouteChat'") try await routeGuide.routeChat { writer in From a1191824c5d098fce97e8800371b2a6358e1f2c2 Mon Sep 17 00:00:00 2001 From: Fumiya Yamanaka Date: Fri, 14 Nov 2025 19:33:40 +0900 Subject: [PATCH 6/7] Update tutorial examples to use .Client instead of the existential ClientProtocol type. --- .../Resources/route-guide-sec06-step06-get-feature.swift | 2 +- .../route-guide-sec06-step07-list-features.swift | 4 ++-- .../Resources/route-guide-sec06-step08-record-route.swift | 6 +++--- .../Resources/route-guide-sec06-step09-route-chat.swift | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step06-get-feature.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step06-get-feature.swift index 9568a9e9..28ae2136 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step06-get-feature.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step06-get-feature.swift @@ -14,7 +14,7 @@ extension RouteGuide { } } - private func getFeature(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { + private func getFeature(using routeGuide: Routeguide_RouteGuide.Client) async throws { print("→ Calling 'GetFeature'") let point = Routeguide_Point.with { diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step07-list-features.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step07-list-features.swift index 0e1276eb..534aa896 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step07-list-features.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step07-list-features.swift @@ -15,7 +15,7 @@ extension RouteGuide { } } - private func getFeature(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { + private func getFeature(using routeGuide: Routeguide_RouteGuide.Client) async throws { print("→ Calling 'GetFeature'") let point = Routeguide_Point.with { @@ -27,7 +27,7 @@ extension RouteGuide { print("Got feature '\(feature.name)'") } - private func listFeatures(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { + private func listFeatures(using routeGuide: Routeguide_RouteGuide.Client) async throws { print("→ Calling 'ListFeatures'") let boundingRectangle = Routeguide_Rectangle.with { diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step08-record-route.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step08-record-route.swift index a6d97382..537154f2 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step08-record-route.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step08-record-route.swift @@ -16,7 +16,7 @@ extension RouteGuide { } } - private func getFeature(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { + private func getFeature(using routeGuide: Routeguide_RouteGuide.Client) async throws { print("→ Calling 'GetFeature'") let point = Routeguide_Point.with { @@ -28,7 +28,7 @@ extension RouteGuide { print("Got feature '\(feature.name)'") } - private func listFeatures(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { + private func listFeatures(using routeGuide: Routeguide_RouteGuide.Client) async throws { print("→ Calling 'ListFeatures'") let boundingRectangle = Routeguide_Rectangle.with { @@ -51,7 +51,7 @@ extension RouteGuide { } } - private func recordRoute(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { + private func recordRoute(using routeGuide: Routeguide_RouteGuide.Client) async throws { print("→ Calling 'RecordRoute'") let features = try self.loadFeatures() diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step09-route-chat.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step09-route-chat.swift index d72503ed..2087dd15 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step09-route-chat.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step09-route-chat.swift @@ -17,7 +17,7 @@ extension RouteGuide { } } - private func getFeature(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { + private func getFeature(using routeGuide: Routeguide_RouteGuide.Client) async throws { print("→ Calling 'GetFeature'") let point = Routeguide_Point.with { @@ -29,7 +29,7 @@ extension RouteGuide { print("Got feature '\(feature.name)'") } - private func listFeatures(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { + private func listFeatures(using routeGuide: Routeguide_RouteGuide.Client) async throws { print("→ Calling 'ListFeatures'") let boundingRectangle = Routeguide_Rectangle.with { @@ -52,7 +52,7 @@ extension RouteGuide { } } - private func recordRoute(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { + private func recordRoute(using routeGuide: Routeguide_RouteGuide.Client) async throws { print("→ Calling 'RecordRoute'") let features = try self.loadFeatures() @@ -74,7 +74,7 @@ extension RouteGuide { ) } - private func routeChat(using routeGuide: Routeguide_RouteGuide.ClientProtocol) async throws { + private func routeChat(using routeGuide: Routeguide_RouteGuide.Client) async throws { print("→ Calling 'RouteChat'") try await routeGuide.routeChat { writer in From baccc0935410950b891e84619f200bd0cbb84406 Mon Sep 17 00:00:00 2001 From: Fumiya Yamanaka Date: Mon, 17 Nov 2025 11:19:16 +0900 Subject: [PATCH 7/7] Format --- .../route-guide-sec06-step06-get-feature.swift | 4 +++- .../route-guide-sec06-step07-list-features.swift | 8 ++++++-- .../route-guide-sec06-step08-record-route.swift | 12 +++++++++--- .../route-guide-sec06-step09-route-chat.swift | 16 ++++++++++++---- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step06-get-feature.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step06-get-feature.swift index 28ae2136..6809b54f 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step06-get-feature.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step06-get-feature.swift @@ -14,7 +14,9 @@ extension RouteGuide { } } - private func getFeature(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func getFeature( + using routeGuide: Routeguide_RouteGuide.Client + ) async throws { print("→ Calling 'GetFeature'") let point = Routeguide_Point.with { diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step07-list-features.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step07-list-features.swift index 534aa896..c276819d 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step07-list-features.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step07-list-features.swift @@ -15,7 +15,9 @@ extension RouteGuide { } } - private func getFeature(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func getFeature( + using routeGuide: Routeguide_RouteGuide.Client + ) async throws { print("→ Calling 'GetFeature'") let point = Routeguide_Point.with { @@ -27,7 +29,9 @@ extension RouteGuide { print("Got feature '\(feature.name)'") } - private func listFeatures(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func listFeatures( + using routeGuide: Routeguide_RouteGuide.Client + ) async throws { print("→ Calling 'ListFeatures'") let boundingRectangle = Routeguide_Rectangle.with { diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step08-record-route.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step08-record-route.swift index 537154f2..12ab60af 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step08-record-route.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step08-record-route.swift @@ -16,7 +16,9 @@ extension RouteGuide { } } - private func getFeature(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func getFeature( + using routeGuide: Routeguide_RouteGuide.Client + ) async throws { print("→ Calling 'GetFeature'") let point = Routeguide_Point.with { @@ -28,7 +30,9 @@ extension RouteGuide { print("Got feature '\(feature.name)'") } - private func listFeatures(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func listFeatures( + using routeGuide: Routeguide_RouteGuide.Client + ) async throws { print("→ Calling 'ListFeatures'") let boundingRectangle = Routeguide_Rectangle.with { @@ -51,7 +55,9 @@ extension RouteGuide { } } - private func recordRoute(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func recordRoute( + using routeGuide: Routeguide_RouteGuide.Client + ) async throws { print("→ Calling 'RecordRoute'") let features = try self.loadFeatures() diff --git a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step09-route-chat.swift b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step09-route-chat.swift index 2087dd15..803d76f6 100644 --- a/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step09-route-chat.swift +++ b/Sources/GRPCCore/Documentation.docc/Tutorials/Route-Guide/Resources/route-guide-sec06-step09-route-chat.swift @@ -17,7 +17,9 @@ extension RouteGuide { } } - private func getFeature(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func getFeature( + using routeGuide: Routeguide_RouteGuide.Client + ) async throws { print("→ Calling 'GetFeature'") let point = Routeguide_Point.with { @@ -29,7 +31,9 @@ extension RouteGuide { print("Got feature '\(feature.name)'") } - private func listFeatures(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func listFeatures( + using routeGuide: Routeguide_RouteGuide.Client + ) async throws { print("→ Calling 'ListFeatures'") let boundingRectangle = Routeguide_Rectangle.with { @@ -52,7 +56,9 @@ extension RouteGuide { } } - private func recordRoute(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func recordRoute( + using routeGuide: Routeguide_RouteGuide.Client + ) async throws { print("→ Calling 'RecordRoute'") let features = try self.loadFeatures() @@ -74,7 +80,9 @@ extension RouteGuide { ) } - private func routeChat(using routeGuide: Routeguide_RouteGuide.Client) async throws { + private func routeChat( + using routeGuide: Routeguide_RouteGuide.Client + ) async throws { print("→ Calling 'RouteChat'") try await routeGuide.routeChat { writer in