This is a simple question, but I can’t figure it out.
I have a basic button in SwiftUI:
Button("Sign out") {...}
This works fine ans shows a button with “Sign out” text.
I want to extract my texts to a separate file doing it like this:
struct ProfileViewLabels {
static let SignInButtonText = "Sign in"
static let SignOutButtonText: String = "Sign out"
}
Using it looks like this:
Button(ProfileViewLabels.SignOutText) {...}
This causes an error:
Cannot convert value of type 'String' to expected argument type 'LocalizedStringKey'
The button is defined like this:
public struct KlikButtonOutline: View {
let title: LocalizedStringKey
let disabled: Bool
let action: () -> Void
}
I do realice the the input is declared a localizable string, but why it "Some text"
a localizable string and let text = "Some text"
not?