From 5eb58994fa88f63e18d2b12f101907e8e57706f6 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Thu, 2 Nov 2023 12:46:15 -0700 Subject: [PATCH] Use `Text.init(verbatim:)` to avoid localization warnings (#131) --- Sources/SwiftUINavigation/Alert.swift | 12 ++++++------ Sources/SwiftUINavigation/ConfirmationDialog.swift | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Sources/SwiftUINavigation/Alert.swift b/Sources/SwiftUINavigation/Alert.swift index b771ddce30..699aa64c64 100644 --- a/Sources/SwiftUINavigation/Alert.swift +++ b/Sources/SwiftUINavigation/Alert.swift @@ -61,7 +61,7 @@ @ViewBuilder message: (Value) -> M ) -> some View { self.alert( - value.wrappedValue.map(title) ?? Text(""), + value.wrappedValue.map(title) ?? Text(verbatim: ""), isPresented: value.isPresent(), presenting: value.wrappedValue, actions: actions, @@ -122,7 +122,7 @@ action handler: @escaping (Value?) -> Void = { (_: Never?) in } ) -> some View { self.alert( - (value.wrappedValue?.title).map(Text.init) ?? Text(""), + (value.wrappedValue?.title).map(Text.init) ?? Text(verbatim: ""), isPresented: value.isPresent(), presenting: value.wrappedValue, actions: { @@ -155,7 +155,7 @@ action handler: @escaping (Value?) async -> Void = { (_: Never?) async in } ) -> some View { self.alert( - (value.wrappedValue?.title).map(Text.init) ?? Text(""), + (value.wrappedValue?.title).map(Text.init) ?? Text(verbatim: ""), isPresented: value.isPresent(), presenting: value.wrappedValue, actions: { @@ -228,7 +228,7 @@ action handler: @escaping (Value?) -> Void ) -> some View { self.alert( - (value.wrappedValue?.title).map(Text.init) ?? Text(""), + (value.wrappedValue?.title).map(Text.init) ?? Text(verbatim: ""), isPresented: value.isPresent(), presenting: value.wrappedValue, actions: { @@ -246,7 +246,7 @@ action handler: @escaping (Value?) async -> Void ) -> some View { self.alert( - (value.wrappedValue?.title).map(Text.init) ?? Text(""), + (value.wrappedValue?.title).map(Text.init) ?? Text(verbatim: ""), isPresented: value.isPresent(), presenting: value.wrappedValue, actions: { @@ -263,7 +263,7 @@ unwrapping value: Binding?> ) -> some View { self.alert( - (value.wrappedValue?.title).map(Text.init) ?? Text(""), + (value.wrappedValue?.title).map(Text.init) ?? Text(verbatim: ""), isPresented: value.isPresent(), presenting: value.wrappedValue, actions: { diff --git a/Sources/SwiftUINavigation/ConfirmationDialog.swift b/Sources/SwiftUINavigation/ConfirmationDialog.swift index cd5a776c35..cdec553ae0 100644 --- a/Sources/SwiftUINavigation/ConfirmationDialog.swift +++ b/Sources/SwiftUINavigation/ConfirmationDialog.swift @@ -66,7 +66,7 @@ @ViewBuilder message: (Value) -> M ) -> some View { self.confirmationDialog( - value.wrappedValue.map(title) ?? Text(""), + value.wrappedValue.map(title) ?? Text(verbatim: ""), isPresented: value.isPresent(), titleVisibility: titleVisibility, presenting: value.wrappedValue, @@ -130,7 +130,7 @@ action handler: @escaping (Value?) -> Void = { (_: Never?) in } ) -> some View { self.confirmationDialog( - value.wrappedValue.flatMap { Text($0.title) } ?? Text(""), + value.wrappedValue.flatMap { Text($0.title) } ?? Text(verbatim: ""), isPresented: value.isPresent(), titleVisibility: value.wrappedValue.map { .init($0.titleVisibility) } ?? .automatic, presenting: value.wrappedValue, @@ -164,7 +164,7 @@ action handler: @escaping (Value?) async -> Void = { (_: Never?) async in } ) -> some View { self.confirmationDialog( - value.wrappedValue.flatMap { Text($0.title) } ?? Text(""), + value.wrappedValue.flatMap { Text($0.title) } ?? Text(verbatim: ""), isPresented: value.isPresent(), titleVisibility: value.wrappedValue.map { .init($0.titleVisibility) } ?? .automatic, presenting: value.wrappedValue, @@ -240,7 +240,7 @@ action handler: @escaping (Value?) -> Void ) -> some View { self.confirmationDialog( - value.wrappedValue.flatMap { Text($0.title) } ?? Text(""), + value.wrappedValue.flatMap { Text($0.title) } ?? Text(verbatim: ""), isPresented: value.isPresent(), titleVisibility: value.wrappedValue.map { .init($0.titleVisibility) } ?? .automatic, presenting: value.wrappedValue, @@ -259,7 +259,7 @@ action handler: @escaping (Value?) async -> Void ) -> some View { self.confirmationDialog( - value.wrappedValue.flatMap { Text($0.title) } ?? Text(""), + value.wrappedValue.flatMap { Text($0.title) } ?? Text(verbatim: ""), isPresented: value.isPresent(), titleVisibility: value.wrappedValue.map { .init($0.titleVisibility) } ?? .automatic, presenting: value.wrappedValue,