asb2004/SwiftySnap
SwiftySnap - Swift Package for Custom camera
β¨ Features
- π· Full-screen custom camera (
SwiftySnapViewController.xibis 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 SwiftySnap2. 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 / .BothVideo 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