File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
FirebaseVertexAI/Sample/ChatSample/Views Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -16,8 +16,9 @@ import FirebaseVertexAI
16
16
import MarkdownUI
17
17
import SwiftUI
18
18
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 {
21
22
switch self {
22
23
case . dangerousContent: " Dangerous content "
23
24
case . harassment: " Harassment "
@@ -28,8 +29,9 @@ extension HarmCategory: CustomStringConvertible {
28
29
}
29
30
}
30
31
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 {
33
35
switch self {
34
36
case . high: " High "
35
37
case . low: " Low "
@@ -73,10 +75,9 @@ private struct SafetyRatingsSection: View {
73
75
Section ( " Safety ratings " ) {
74
76
List ( ratings, id: \. self) { rating in
75
77
HStack {
76
- Text ( " \( String ( describing: rating. category) ) " )
77
- . font ( . subheadline)
78
+ Text ( rating. category. displayValue) . font ( . subheadline)
78
79
Spacer ( )
79
- Text ( " \( String ( describing : rating. probability) ) " )
80
+ Text ( rating. probability. displayValue )
80
81
}
81
82
}
82
83
}
You can’t perform that action at this time.
0 commit comments