Skip to content

k-arindam/SwiftUICamera

Repository files navigation

Banner

SwiftUICamera

Seamless camera integration for SwiftUI.

SwiftUICamera makes it effortless to add rich camera functionality to your SwiftUI applications β€” with support for photo capture, video recording, live frame output, and full control over camera hardware.


πŸ“Έ Features

  • Easy integration with SwiftUI using SUICameraView
  • Capture photos and record videos
  • Access real-time camera frames as UIImage or CIImage
  • Control over:
    • Video quality
    • Shutter speed
    • ISO
    • White balance
  • Simple delegate protocol for receiving media output
  • Upcoming support for:
    • Lens switching (wide/ultrawide/telephoto)
    • Zoom and focus control
    • Flash toggle
    • ProRAW capture

πŸš€ Getting Started

πŸ”§ Installation

βœ… Swift Package Manager

  1. Open your Xcode project.
  2. Navigate to File > Add Packages.
  3. Enter the SwiftUICamera repository URL:
    https://github.com/k-arindam/SwiftUICamera.git
    
  4. Choose the latest version and add it to your app target.

πŸ› οΈ Setup

πŸ“„ Info.plist

To access the camera, microphone, and save media to the Photo Library, add the following entries in your app's Info.plist:

Info.plist


πŸ“¦ Example Usage

ExampleApp


🧰 API Reference

πŸ” SUICameraViewModel

Create and configure a camera session:

Configure

πŸ“Έ Capture Photos and Videos

Capture

βš™οΈ Camera Controls

Controls

(Upcoming APIs: focus, zoom, lens toggle, flash, ProRAW)


πŸ”„ SUICameraDataDelegate

Set a delegate to receive output:

viewModel.dataDelegate = YourDelegate()

Optional Methods

func photoOutput(_ photo: AVCapturePhoto, error: Error?)
func photoOutput(_ photo: UIImage?)
func finishedRecording(at url: URL, error: Error?)
func frameOutput(ciImage: CIImage)
func frameOutput(original uiImage: UIImage?)
func frameOutput(rotated uiImage: UIImage?)

πŸ” Privacy

This package uses device camera and microphone. Make sure your app clearly informs users why access is required.


πŸ“¦ Legal


πŸ’¬ Feedback / Contributions

We welcome pull requests, suggestions, and issues. Let’s build the most seamless camera experience in SwiftUI!


πŸ”— Links


Banner image created by Canva AI

Sponsor this project

 

Packages

 
 
 

Contributors