Skip to content

AndreasInk/DeveloperSignatureKit

Repository files navigation

DeveloperSignatureKit

The package owns the small product-facing card shown at the end of settings screens: app icon, profile-image placement, name and role row, thank-you copy, and an animated vector signature.

Explore Andreas Ink apps and projects at andreas.ink.

ScreenRecording_07-05-2026.12-38-10_1.mov

Requirements

  • Swift 5.9 or later.
  • iOS 17, macOS 14, tvOS 17, or visionOS 1.
  • SwiftUI.

Installation

Use Swift Package Manager:

.package(url: "https://github.com/AndreasInk/DeveloperSignatureKit.git", from: "1.3.0")

Then add the DeveloperSignatureKit product to the app target that renders the settings footer.

Quick Start

Use DeveloperSignatureCard when an app needs to pass its own name, copy, or images:

DeveloperSignatureCard(
    signature: SignedSignatureView("Your Name"),
    personalizationMessage: "Thanks for supporting the app.",
    developerName: "Your Name",
    role: "Developer",
    profileImage: Image("ProfilePhoto"),
    appIconImage: Image("AppIconPreview")
)

If appIconImage is nil and showsAppIcon is true, the card attempts to read the host app icon from Bundle.main.

String Signatures

SignedSignatureView renders a developer name from the built-in signed alphabet:

SignedSignatureView("Andreas Ink")

The alphabet supports A-Z, lowercase input rendered as smaller follow-on strokes, spaces, hyphen, period, apostrophes, and simple diacritics that fold to a base letter. Validate a string before shipping it:

let unsupported = SignedSignatureAlphabet.unsupportedCharacters(in: "Ava 2.0!")

See SignedAlphabet.md for supported input and preview validation notes.

Programmatic Personalization

Use ProgrammaticSignatureView when a developer wants the signature to feel closer to their own handwriting without drawing it manually:

let style = ProgrammaticSignatureStyle(
    lineWidth: 3.8,
    slant: 0.32,
    characterSpacing: -0.04,
    roundedness: 0.9,
    baselineWobble: 0.6,
    scaleVariance: 0.4,
    flourishStrength: 1.12,
    uppercaseEmphasis: 1.05,
    replaySpeed: 1.2,
    seed: 42
)

ProgrammaticSignatureView("Your Name", style: style)

The style is Codable, so apps can persist a developer's chosen look. See PersonalizedSignatures.md for the full parameter guide.

Captured Signatures

On iOS, SignatureCaptureView records Apple Pencil or touch input into a codable CapturedSignature:

@State private var signature: CapturedSignature?

SignatureCaptureView(signature: $signature)

Replay a captured signature anywhere SwiftUI accepts a view:

if let signature {
    CapturedSignatureReplayView(signature: signature)
}

Captured signatures store normalized vector points and timing, not bitmap images, so they can be saved as JSON and replayed as if they are being written. CapturedSignature(jsonData:) rejects future formatVersion values so apps do not silently load data written by a newer format. CapturedSignatureReplayView(signature:) preserves raw canvas-space framing by default for compatibility. Pass trimsWhitespace: true, or build a CapturedSignatureRenderModel(signature:trimsWhitespace:) once and reuse it, when a signature exported from a large drawing surface should fit its destination slot.

Preview Catalog

Preview Use Case Notes
Default placeholder profile Package default No personal profile photo is bundled in the package.
App-provided profile image Production app footer Pass profileImage: Image("YourProfileAsset") from the consuming app target.
Signed alphabet String-driven signatures Use SignedSignatureView("Your Name") and validate with SignedSignatureAlphabet.
Programmatic styles Developer-tuned signatures Try line width, slant, spacing, roundedness, baseline wobble, scale variance, flourish, uppercase emphasis, replay speed, and seed changes.
Captured replay Pencil/touch signatures Use CapturedSignatureReplayView to verify saved strokes replay cleanly.
Card integration Settings footer preview Render DeveloperSignatureCard(signature: SignedSignatureView(...)) before shipping.

The example app at Examples/SignatureStudio is the preview catalog for live personalization. It includes a draw mode for iPad + Apple Pencil and a tune mode for developers who want a programmatic signature. Captured signatures can be exported from the draw mode as DeveloperSignature.json for bundling in a consuming app target.

Public API

  • AndreasDeveloperSignatureCard: convenience card for Andreas Ink apps.
  • DeveloperSignatureCard: generic card with custom signature, copy, profile image, and app icon options.
  • AndreasSignatureView: animated SwiftUI vector signature.
  • SignedSignatureView: string-driven SwiftUI vector signature backed by the built-in signed alphabet.
  • SignedSignatureAlphabet: validation helpers for supported signature text.
  • ProgrammaticSignatureView: string-driven signature with tunable personal style parameters.
  • ProgrammaticSignatureStyle: codable style model for generated signatures.
  • SignatureInk: codable RGBA ink used by programmatic and captured signatures.
  • CapturedSignature: codable vector signature format with normalized points and timing.
  • SignatureCanvasSize: codable source canvas dimensions for captured signatures.
  • CapturedSignatureStroke: codable captured stroke with points and optional style metadata.
  • CapturedSignaturePoint: codable normalized point with timing and optional force.
  • CapturedSignatureError: captured-signature decoding errors.
  • CapturedSignatureRenderModel: precomputed replay geometry; build once per changed signature and reuse across replay views.
  • CapturedSignatureReplayView: SwiftUI replay view for a saved captured signature.
  • SignatureCaptureView: iOS-only Apple Pencil/touch capture surface.
  • DeveloperSignatureAssets.defaultProfileImage: generic system placeholder for custom composition.

Behavior Notes

  • The signature respects Reduce Motion and renders complete without animation when motion is reduced.
  • Captured signatures replay with the original point timing and respect Reduce Motion.
  • CapturedSignatureReplayView(signature:) preserves raw canvas-space framing by default; pass trimsWhitespace: true or reuse a trimmed CapturedSignatureRenderModel when the signature should fit tightly.
  • SignatureCaptureView is available on iOS only because it uses PencilKit.
  • The card fades in once and replays the signature when it becomes visible in a scroll view on supported OS versions.
  • App icon lookup is best-effort. If the main bundle does not expose an icon through CFBundleIcons, the card still renders the profile image and text.
  • The package does not bundle a personal profile photo. Apps should pass their own profileImage when needed.

Verification

For package-only work:

swift test
swift build --triple arm64-apple-ios17.0-simulator

The host test lane covers shared models and SwiftUI construction. The iOS simulator build is required for SignatureCaptureView because PencilKit code is compiled only on iOS. For app integration, build the consuming app target through Xcode or the repo's native Xcode verification tools. UI changes should be visually inspected in a preview, simulator, or device.

For render-performance smoke checks:

swift test --filter DeveloperSignatureKitPerformanceTests

Those XCTest metrics host the SwiftUI signature, card, and captured replay views to catch hangs or obvious layout hot spots. Treat them as an early warning lane; animation hitch confidence still needs a Release build on a physical device with Instruments or an XCUITest performance scheme.

For the iOS example app:

cd Examples/SignatureStudio
xcodegen generate
open SignatureStudio.xcodeproj
xcodebuild -project SignatureStudio.xcodeproj -scheme SignatureStudio -destination 'generic/platform=iOS Simulator' build

Release Status

  • Personal profile photos are app-provided, not bundled.
  • The README includes a preview catalog.
  • Current semantic version: 1.3.0.
  • Consumers should use version requirements instead of branch tracking.

About

Adds a personalized signature to your SwiftUI app

Topics

Resources

License

Stars

3 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages