Add Support LocalizedString For Placeholder Text
mergesort opened this issue · 2 comments
The current ResponsiveTextField
initializer supports a placeholder
property, but I can't find a way to pair it with a LocalizedString
.
public init(
placeholder: String,
text: Binding<String>,
isSecure: Bool = false,
adjustsFontForContentSizeCategory: Bool = true,
firstResponderDemand: Binding<FirstResponderDemand?>? = nil,
configuration: Configuration = .empty,
onFirstResponderStateChanged: FirstResponderStateChangeHandler? = nil,
handleReturn: (() -> Void)? = nil,
handleDelete: ((String) -> Void)? = nil,
shouldChange: ((String, String) -> Bool)? = nil,
supportedStandardEditActions: Set<StandardEditAction>? = nil,
standardEditActionHandler: StandardEditActionHandling<UITextField>? = nil
) {
self.placeholder = placeholder
self.text = text
self.firstResponderDemand = firstResponderDemand
self.isSecure = isSecure
self.configuration = configuration
self.adjustsFontForContentSizeCategory = adjustsFontForContentSizeCategory
self.onFirstResponderStateChanged = onFirstResponderStateChanged
self.handleReturn = handleReturn
self.handleDelete = handleDelete
self.shouldChange = shouldChange
self.supportedStandardEditActions = supportedStandardEditActions
self.standardEditActionHandler = standardEditActionHandler
}
This is preventing me from using localized text like "ICON_SELECTION_VIEW_SEARCH_BAR_PLACEHOLDER_TEXT" = "Find an icon";
. I tried going through the configuration
property as well, is there any way to use localized strings with the placeholder property that I'm overlooking?
The placeholder
property is a String
so I'm not sure what would be an appropriate API to expose here.
Have you tried using NSLocalizedString(...)
?
Oh duh, I've been working with SwiftUI so long that I completely forgot about NSLocalizedString as a viable option. Sorry about that, everything works great now!