Swiftpack.co - jeffgrann/SwiftUISignature as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by jeffgrann.
jeffgrann/SwiftUISignature 1.0.40
A SwiftUI view that enables a user to draw their signature.
⭐️ 0
🕓 1 week ago
iOS
.package(url: "https://github.com/jeffgrann/SwiftUISignature.git", from: "1.0.40")

SwiftUISignature

Creates SwiftUI views that allow a user to draw their signature on screen, generating a UIImage as they draw.

Compatibility

  • iOS 13+
  • Swift 5.5
  • SwiftUI 3.0

Overview

Demo

SwiftUISignature has standard styling that works properly in light and dark modes and can also be styled in any way using a SignatureStyle:

SwiftUISignature Demo

Simple usage

import SwiftUI
import SwiftUISignature

struct MySignatureView: View {
    @State var signature: UIImage? = nil

    var body: some View {
        Signature($signature)
    }
}

Customizing with parameters and styling

Signature($signature,
          placeholder: "Please Sign Here",
          onChange: { Save the changes... })
    .signatureStyle(SignatureStyle(
        color: .red,
        lineWidth: 5,
        border: .roundedRectangle(cornerRadius: 10,
                                  color: .black,
                                  width: 2),
        backgroundColor: .yellow,
        placeholderColor: .secondary,
        clearButtonTitle: "Clear Signature",
        clearButtonBottomPadding: 5))

Styling the clear button

Signature($signature)
    .buttonStyle(.bordered)

Styling the placeholder font

Signature($signature)
    .font(Font.custom("Helvetica Neue", size: 36))

Sizing

This is a "push-out" view. Use the frame view modifier to constrain its size.

Installation

This component is distributed as a Swift package. Just add the repo URL to your package list:

https://github.com/jeffgrann/SwiftUISignature

Acknowledgement

Thanks to SwiftUI Digital Signature for code and inspiration.

GitHub

link
Stars: 0
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Full release.
1 week ago

This is the first full release.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics