Skip to content

Commit 289a1b9

Browse files
authored
[Vertex AI] Replace sample CustomStringConvertible extensions (#13845)
1 parent 78f970b commit 289a1b9

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

FirebaseVertexAI/Sample/ChatSample/Views/ErrorDetailsView.swift

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ import FirebaseVertexAI
1616
import MarkdownUI
1717
import SwiftUI
1818

19-
extension HarmCategory: CustomStringConvertible {
20-
public var description: String {
19+
private extension HarmCategory {
20+
/// Returns a description of the `HarmCategory` suitable for displaying in the UI.
21+
var displayValue: String {
2122
switch self {
2223
case .dangerousContent: "Dangerous content"
2324
case .harassment: "Harassment"
@@ -28,8 +29,9 @@ extension HarmCategory: CustomStringConvertible {
2829
}
2930
}
3031

31-
extension SafetyRating.HarmProbability: CustomStringConvertible {
32-
public var description: String {
32+
private extension SafetyRating.HarmProbability {
33+
/// Returns a description of the `HarmProbability` suitable for displaying in the UI.
34+
var displayValue: String {
3335
switch self {
3436
case .high: "High"
3537
case .low: "Low"
@@ -73,10 +75,9 @@ private struct SafetyRatingsSection: View {
7375
Section("Safety ratings") {
7476
List(ratings, id: \.self) { rating in
7577
HStack {
76-
Text("\(String(describing: rating.category))")
77-
.font(.subheadline)
78+
Text(rating.category.displayValue).font(.subheadline)
7879
Spacer()
79-
Text("\(String(describing: rating.probability))")
80+
Text(rating.probability.displayValue)
8081
}
8182
}
8283
}

0 commit comments

Comments
 (0)