62 lines
1.2 KiB
Swift
62 lines
1.2 KiB
Swift
import SwiftUI
|
|
|
|
extension TextField where Label == Text {
|
|
|
|
public init(
|
|
_ titleKey: LocalizedStringKey,
|
|
value: Binding<Double?>,
|
|
fractionLength: Int,
|
|
prompt: Text? = nil
|
|
) {
|
|
self.init(
|
|
titleKey,
|
|
value: value,
|
|
format: .number.precision(.fractionLength(fractionLength)),
|
|
prompt: prompt
|
|
)
|
|
}
|
|
|
|
public init<S: StringProtocol>(
|
|
_ titleKey: S,
|
|
value: Binding<Double?>,
|
|
fractionLength: Int,
|
|
prompt: Text? = nil
|
|
) {
|
|
self.init(
|
|
titleKey,
|
|
value: value,
|
|
format: .number.precision(.fractionLength(fractionLength)),
|
|
prompt: prompt
|
|
)
|
|
}
|
|
|
|
public init(
|
|
_ titleKey: LocalizedStringKey,
|
|
value: Binding<Double>,
|
|
fractionLength: Int,
|
|
prompt: Text? = nil
|
|
) {
|
|
self.init(
|
|
titleKey,
|
|
value: value,
|
|
format: .number.precision(.fractionLength(fractionLength)),
|
|
prompt: prompt
|
|
)
|
|
}
|
|
|
|
public init<S: StringProtocol>(
|
|
_ titleKey: S,
|
|
value: Binding<Double>,
|
|
fractionLength: Int,
|
|
prompt: Text? = nil
|
|
) {
|
|
self.init(
|
|
titleKey,
|
|
value: value,
|
|
format: .number.precision(.fractionLength(fractionLength)),
|
|
prompt: prompt
|
|
)
|
|
}
|
|
|
|
}
|