diff options
Diffstat (limited to 'Demo/SwiftyCropDemo/UIElements')
-rw-r--r-- | Demo/SwiftyCropDemo/UIElements/DecimalTextField.swift | 20 | ||||
-rw-r--r-- | Demo/SwiftyCropDemo/UIElements/LongText.swift | 21 |
2 files changed, 41 insertions, 0 deletions
diff --git a/Demo/SwiftyCropDemo/UIElements/DecimalTextField.swift b/Demo/SwiftyCropDemo/UIElements/DecimalTextField.swift new file mode 100644 index 0000000..f616413 --- /dev/null +++ b/Demo/SwiftyCropDemo/UIElements/DecimalTextField.swift @@ -0,0 +1,20 @@ +import SwiftUI + +struct DecimalTextField: View { + @Binding var value: CGFloat + private let decimalFormatter: NumberFormatter = { + let formatter = NumberFormatter() + formatter.numberStyle = .decimal + formatter.allowsFloats = true + formatter.minimumFractionDigits = 1 + formatter.decimalSeparator = "." + return formatter + }() + + var body: some View { + TextField("maxMagnification", value: $value, formatter: decimalFormatter) + .textFieldStyle(RoundedBorderTextFieldStyle()) + .multilineTextAlignment(.trailing) + .keyboardType(.decimalPad) + } +} diff --git a/Demo/SwiftyCropDemo/UIElements/LongText.swift b/Demo/SwiftyCropDemo/UIElements/LongText.swift new file mode 100644 index 0000000..77e211a --- /dev/null +++ b/Demo/SwiftyCropDemo/UIElements/LongText.swift @@ -0,0 +1,21 @@ +// +// LongText.swift +// SwiftyCropDemo +// +// Created by Leonid Zolotarev on 1/24/24. +// + +import SwiftUI + +struct LongText: View { + let title: String + + var body: some View { + Text(title) + .frame(maxWidth: .infinity) + } +} + +#Preview { + LongText(title: "title") +} |