SignatureCaptureView
public struct SignatureCaptureView
extension SignatureCaptureView: View
extension SignatureCaptureView: _ViewEmptyChecking
SignatureCaptureView allows user to sign above the signature line.
Usage
SignatureCaptureView(title: "Signature Title", isRequired: true, startSignatureAction: {
Button(action: {}, label: { Text("start") })
}, reenterSignatureAction: {
Button(action: {}, label: { Text("restart") })
}, cancelAction: {
Button(action: {}, label: { Text("cancel") })
}, clearAction: {
Button(action: {}, label: { Text("clear") })
}, saveAction: {
Button(action: {}, label: { Text("save") })
}, xmark: {
Image(systemName: "xmark")
}, watermark: {
Text("This is a watermark")
}, signatureImage: nil,
drawingViewMaxHeight: 400,
drawingViewBackgroundColor: Color.gray,
strokeWidth: 1,
appliesTintColorToImage: true,
strokeColor: Color.red,
signatureLineColor: Color.black,
hidesSignatureLine: false,
watermarkAlignment: .trailing,
addsTimestampInImage: true,
timestampFormatter: nil,
cropsImage: false) { img in
let imgSaver = ImageSaver()
imgSaver.writeToPhotoAlbum(image: img)
}
-
init(title:startSignatureAction: reenterSignatureAction: cancelAction: clearAction: saveAction: xmark: watermark: signatureImage: drawingViewMaxHeight: drawingViewBackgroundColor: strokeWidth: appliesTintColorToImage: strokeColor: signatureLineColor: hidesSignatureLine: watermarkAlignment: addsTimestampInImage: timestampFormatter: cropsImage: onSave: onDelete: componentIdentifier: ) Undocumented
Declaration
Swift
public init(@ViewBuilder title: () -> any View, @ViewBuilder startSignatureAction: () -> any View = { FioriButton { _ in Text("Tap to Sign".localizedFioriString()) } }, @ViewBuilder reenterSignatureAction: () -> any View = { FioriButton { _ in Text("Re-enter Signature".localizedFioriString()) } }, @ViewBuilder cancelAction: () -> any View = { FioriButton { _ in Text("Cancel".localizedFioriString()) } }, @ViewBuilder clearAction: () -> any View = { FioriButton { _ in Text("Clear".localizedFioriString()) } }, @ViewBuilder saveAction: () -> any View = { FioriButton { _ in Text("Save".localizedFioriString()) } }, @ViewBuilder xmark: () -> any View = { Image(systemName: "xmark") }, @ViewBuilder watermark: () -> any View = { EmptyView() }, signatureImage: UIImage? = nil, drawingViewMaxHeight: CGFloat? = nil, drawingViewBackgroundColor: Color = Color.preferredColor(.primaryBackground), strokeWidth: CGFloat = 3, appliesTintColorToImage: Bool = true, strokeColor: Color = Color.preferredColor(.primaryLabel), signatureLineColor: Color = Color.preferredColor(.quaternaryLabel), hidesSignatureLine: Bool = false, watermarkAlignment: HorizontalAlignment = .leading, addsTimestampInImage: Bool = false, timestampFormatter: DateFormatter? = nil, cropsImage: Bool = false, onSave: ((UIImage) -> Void)? = nil, onDelete: (() -> Void)? = nil, componentIdentifier: String? = SignatureCaptureView.identifier) -
init(mandatoryFieldIndicator:isRequired: startSignatureAction: reenterSignatureAction: cancelAction: clearAction: saveAction: xmark: watermark: signatureImage: drawingViewMaxHeight: drawingViewBackgroundColor: strokeWidth: appliesTintColorToImage: strokeColor: signatureLineColor: hidesSignatureLine: watermarkAlignment: addsTimestampInImage: timestampFormatter: cropsImage: onSave: onDelete: componentIdentifier: ) Convenience initializer for signature capture view.
Declaration
Swift
init(@ViewBuilder mandatoryFieldIndicator: () -> any View = { Text("*") }, isRequired: Bool = false, @ViewBuilder startSignatureAction: () -> any View = { FioriButton { _ in Text("Tap to Sign".localizedFioriString()) } }, @ViewBuilder reenterSignatureAction: () -> any View = { FioriButton { _ in Text("Re-enter Signature".localizedFioriString()) } }, @ViewBuilder cancelAction: () -> any View = { FioriButton { _ in Text("Cancel".localizedFioriString()) } }, @ViewBuilder clearAction: () -> any View = { FioriButton { _ in Text("Clear".localizedFioriString()) } }, @ViewBuilder saveAction: () -> any View = { FioriButton { _ in Text("Save".localizedFioriString()) } }, @ViewBuilder xmark: () -> any View = { Image(systemName: "xmark") }, @ViewBuilder watermark: () -> any View = { EmptyView() }, signatureImage: UIImage? = nil, drawingViewMaxHeight: CGFloat? = nil, drawingViewBackgroundColor: Color = Color.preferredColor(.primaryBackground), strokeWidth: CGFloat = 3, appliesTintColorToImage: Bool = true, strokeColor: Color = Color.preferredColor(.primaryLabel), signatureLineColor: Color = Color.preferredColor(.quaternaryLabel), hidesSignatureLine: Bool = false, watermarkAlignment: HorizontalAlignment = .leading, addsTimestampInImage: Bool = false, timestampFormatter: DateFormatter? = nil, cropsImage: Bool = false, onSave: ((UIImage) -> Void)? = nil, onDelete: (() -> Void)? = nil, componentIdentifier: String? = SignatureCaptureView.identifier)Parameters
mandatoryFieldIndicatorIndicator for mandatory field. Default value is
*.isRequiredIndicates if
mandatoryFieldIndicatorshould be displayed. Default value isfalse.startSignatureActionAction for start signature.
reenterSignatureActionAction for re-enter signature.
cancelActionAction for cancel signature.
clearActionAction for clear signature area.
saveActionAction for save signature.
xmarkX-mark for signature view that. Default value is
xmark.watermarkWatermark for signature.
signatureImageA default signature image displayed in signature area. Default value is
nil.drawingViewMaxHeightDrawing view maximum height. Default value is
nil.drawingViewBackgroundColorBackground color for drawing view area. Default value is
.primaryBackground.strokeWidthStroke width for signature. Default value is
3.0.appliesTintColorToImageIndicates if signature image should be tinted by
strokeColor. Default value istrue.strokeColorStroke color for signature. Default value is
.primaryLabel.signatureLineColorLine color for signature. Default value is
.quaternaryLabel.hidesSignatureLineIndicates if signature line should be hidden. Default value is
falsewatermarkAlignmentHorizontal alignment for watermark. Default value is
.leading.addsTimestampInImageIndicates if timestamp should be added in image. Default value is
false.timestampFormatterTimestamp date formatter. Default
dateFormatisMM/dd/YYYY hh:mma zzz.cropsImageIndicates if image should be cropped.
onSaveSave action call back.
onDeleteClear action call back.
componentIdentifierIdentifier of the component.
-
Undocumented
Declaration
Swift
static let identifier: String -
init(title:mandatoryFieldIndicator: isRequired: startSignatureAction: reenterSignatureAction: cancelAction: clearAction: saveAction: xmark: watermark: signatureImage: drawingViewMaxHeight: drawingViewBackgroundColor: strokeWidth: appliesTintColorToImage: strokeColor: signatureLineColor: hidesSignatureLine: watermarkAlignment: addsTimestampInImage: timestampFormatter: cropsImage: onSave: onDelete: ) Undocumented
Declaration
Swift
init(title: AttributedString, mandatoryFieldIndicator: TextOrIcon? = .text("*"), isRequired: Bool = false, startSignatureAction: FioriButton? = FioriButton { _ in Text("Tap to Sign".localizedFioriString()) }, reenterSignatureAction: FioriButton? = FioriButton { _ in Text("Re-enter Signature".localizedFioriString()) }, cancelAction: FioriButton? = FioriButton { _ in Text("Cancel".localizedFioriString()) }, clearAction: FioriButton? = FioriButton { _ in Text("Clear".localizedFioriString()) }, saveAction: FioriButton? = FioriButton { _ in Text("Save".localizedFioriString()) }, xmark: Image? = Image(systemName: "xmark"), watermark: AttributedString? = nil, signatureImage: UIImage? = nil, drawingViewMaxHeight: CGFloat? = nil, drawingViewBackgroundColor: Color = Color.preferredColor(.primaryBackground), strokeWidth: CGFloat = 3, appliesTintColorToImage: Bool = true, strokeColor: Color = Color.preferredColor(.primaryLabel), signatureLineColor: Color = Color.preferredColor(.quaternaryLabel), hidesSignatureLine: Bool = false, watermarkAlignment: HorizontalAlignment = .leading, addsTimestampInImage: Bool = false, timestampFormatter: DateFormatter? = nil, cropsImage: Bool = false, onSave: ((UIImage) -> Void)? = nil, onDelete: (() -> Void)? = nil) -
Undocumented
Declaration
Swift
init(_ configuration: SignatureCaptureViewConfiguration) -
Declaration
Swift
@MainActor public var body: some View { get } -
Undocumented
Declaration
Swift
public var isEmpty: Bool { get }