Contents

asb2004/SwiftySnap

SwiftySnap - Swift Package for Custom camera

✨ Features

  • πŸ“· Full-screen custom camera (SwiftySnapViewController.xib is editable)
  • πŸ’‘ Flash support
  • 🎞️ Photo, Video, or Both modes
  • ⏱ Video duration limit
  • πŸ”„ Front and Back camera
  • 🀏 Pinch to zoom (from 0.5x (Ultra Wide) to 5x)

πŸ“¦ Installation

Swift Package Manager (SPM)

Add the following URL to your Xcode project's Package Dependencies:

https://github.com/asb2004/SwiftySnap.git


Requirements

  • iOS 13.0+

πŸš€ Getting Started

1. Import the module

import SwiftySnap

2. Present the camera

let vc = SwiftySnapViewController()
vc.modalTransitionStyle = .crossDissolve
vc.modalPresentationStyle = .fullScreen
vc.delegate = self
self.present(vc, animated: true)

🎨 Customize Colors

struct CustomColor: SwiftySnapColorProviding {
    var primaryColor: UIColor { .purple }
}

SwiftySnapColorManager.provider = CustomColor()

βš™οΈ Configuration

Camera Type

vc.CameraType = .Photo // or .Video / .Both

Video Recording Duration (in seconds)

vc.maxRecordingDuration = 60

🎯 Delegate Methods

extension YourViewController: SwiftySnapDelegate {
    func cameraDidCapturePhoto(_ image: UIImage) {
        // Called when a photo is captured
    }

    func cameraDidCaptureVideo(url: URL) {
        // Called when video is recorded
    }

    func cameraDidCancel() {
        // Called when camera is dismissed without capturing
    }
}

πŸͺ„ Custom UI

Want to change the layout or style?

Edit the SwiftySnapViewController.xib file inside the module for full design control.

Package Metadata

Repository: asb2004/SwiftySnap

Stars: 2

Forks: 0

Open issues: 0

Default branch: main

Primary language: swift

License: MIT

Topics: custom-camera, ios, swift, swift-package-manager

README: README.md