Skip to content

Commit

Permalink
Add localization support to FieldWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelHolec committed Sep 6, 2024
1 parent 6d8e539 commit e39b488
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Sources/Orbit/Support/Forms/FieldWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,29 @@ public struct FieldWrapper<Label: View, Content: View, Footer: View>: View {
public extension FieldWrapper where Label == Text {

/// Creates Orbit ``FieldWrapper`` around form field content with an additional message content.
@_disfavoredOverload
init(
_ label: String,
_ label: some StringProtocol = String(""),
message: Message? = nil,
messageHeight: Binding<CGFloat> = .constant(0),
@ViewBuilder content: () -> Content,
@ViewBuilder footer: () -> Footer = { EmptyView() }
) {
self.init(
message: message,
messageHeight: messageHeight,
content: content,
label: {
Text(label)
},
footer: footer
)
}

/// Creates Orbit ``FieldWrapper`` around form field content with an additional message content.
@_semantics("swiftui.init_with_localization")
init(
_ label: LocalizedStringKey = "",
message: Message? = nil,
messageHeight: Binding<CGFloat> = .constant(0),
@ViewBuilder content: () -> Content,
Expand Down

0 comments on commit e39b488

Please sign in to comment.