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
mandatoryFieldIndicator
Indicator for mandatory field. Default value is
*
.isRequired
Indicates if
mandatoryFieldIndicator
should be displayed. Default value isfalse
.startSignatureAction
Action for start signature.
reenterSignatureAction
Action for re-enter signature.
cancelAction
Action for cancel signature.
clearAction
Action for clear signature area.
saveAction
Action for save signature.
xmark
X-mark for signature view that. Default value is
xmark
.watermark
Watermark for signature.
signatureImage
A default signature image displayed in signature area. Default value is
nil
.drawingViewMaxHeight
Drawing view maximum height. Default value is
nil
.drawingViewBackgroundColor
Background color for drawing view area. Default value is
.primaryBackground
.strokeWidth
Stroke width for signature. Default value is
3.0
.appliesTintColorToImage
Indicates if signature image should be tinted by
strokeColor
. Default value istrue
.strokeColor
Stroke color for signature. Default value is
.primaryLabel
.signatureLineColor
Line color for signature. Default value is
.quaternaryLabel
.hidesSignatureLine
Indicates if signature line should be hidden. Default value is
false
watermarkAlignment
Horizontal alignment for watermark. Default value is
.leading
.addsTimestampInImage
Indicates if timestamp should be added in image. Default value is
false
.timestampFormatter
Timestamp date formatter. Default
dateFormat
isMM/dd/YYYY hh:mma zzz
.cropsImage
Indicates if image should be cropped.
onSave
Save action call back.
onDelete
Clear action call back.
componentIdentifier
Identifier 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
public var body: some View { get }
-
Undocumented
Declaration
Swift
public var isEmpty: Bool { get }