Aespa
From camera to album, just 2 lines
Install / Use
/learn @enebin/AespaREADME
From camera to album. In just 2 lines.
</div>let aespaOption = AespaOption(albumName: "YOUR_ALBUM_NAME")
let aespaSession = Aespa.session(with: aespaOption)
// Done!
Quick link
Index
- Introduction
- Functionality
- Installation
- Usage
- Implementation Examples
- SwiftUI Integration
- Contributing
- License
Introduction
Aespa is a robust and intuitive Swift package for video and photo capturing, built with a focus on the ease of setting up and usage.
It is designed to be easy to use from beginners to intermediate developers. If you're new to video recording on iOS or if you're looking to simplify your existing camera setup, Aespa could be the perfect fit for your project.
Super easy to use
<details> <summary> Zip the boring configuration for session & album </summary>Before
graph LR
User --> RP["Permission Request"]
RP -- "Granted" --> AS["AVCaptureSession"]
AS -- "Connect" --> AI["AVCaptureVideoInput"]
AS -- "Connect" --> AIA["AVCaptureAudioInput"]
AS -- "Add" --> FO["AVCaptureFileOutput"]
FO --> PHCollectionListChangeRequest
Aespa
graph LR
User --> Aespa --> Session & Album
- Aespa provides an accessible API that abstracts the complexity of
AVFoundation, allowing you to manage video capturing tasks with ease.
graph TD
AS["AespaSession"]
AS --> RV["Recording a new video"]
AS --> Se["Change zoom, video quailty, camera position, ..."]
AS --> AV["Set options like stabilization, orientation ,..."]
AS --> D["Fetching asset files"]
- With Aespa, you can readily adjust a variety of settings.
- For a higher degree of customization, it also supports the creation of custom tunings for the recording session, offering flexible control over your recording needs.
- The package provides comprehensive error handling, allowing you to build robust applications with minimal effort.
No more delegate
<details> <summary> Combine support </summary>graph LR;
A[Session update] -->|Trigger| B[previewLayerPublisher, ...]
B -->|React to Changes| C[Subscribers]
E[Background Thread] --Async--> F["Configure session"] --Finish--> A
- Aespa's API leverages Swift's latest concurrency model to provide asynchronous functions, ensuring smooth and efficient execution of tasks.
- Additionally, it is built with
Combinein mind, enabling you to handle updates such as video output and preview layer reactively using publishers and subscribers.
Also
- Automated system permission management.
- Seamless image and video capture within a single preview session.
- Thread-safe.
- Support SPM.
Functionality
Note
You can access our official documentation for more comprehensive and up-to-date explanations in here
Manual options
| Common | Description |
|----------------------------------|------------------------------------------------------------------------------------------------------------------|
| ✨ zoom | Modifies the zoom factor. |
| ✨ position | Changes the camera position. |
| orientation | Modifies the orientation. |
| focus | Alters the autofocusing mode. |
| quality | Adjusts the video quality preset for the recording session. |
| doctor | Checks if essential conditions to start recording are satisfied. |
| previewLayerPublisher | Responsible for emitting updates to the preview layer. |
| Video | Description |
|----------------------------------|------------------------------------------------------------------------------------------------------------------|
| ✨ startRecording | Initiates the recording of a video session. |
| ✨ stopRecording | Terminates the current video recording session and attempts to save the video file. |
| mute | Mutes the audio input. |
| unmute | Restores the audio input. |
| stabilization | Alters the stabilization mode. |
| torch | Adjusts the torch mode and level. |
| customize | Customizes the session with a specific tuning configuration. |
| ✨ fetchVideoFiles | Fetches a list of recorded video files. |
| videoFilePublisher | Emits a Result object containing a latest video file data. |
| Photo | Description |
|----------------------------------|------------------------------------------------------------------------------------------------------------------|
| ✨ capturePhoto | Capture a photo and returns a result image file. |
| ✨ flashMode | Sets the flash mode for the photo capture session. |
| redEyeReduction | Enables or disables red-eye reduction for the photo capture session. |
| customize | Customizes the photo capture session with a specific AVCapturePhotoSettings. |
| ✨ fetchPhotoFiles | Fetches a list of captured photos files. |
| photoFilePublisher | Emits a Result object containing a latest image file data. |
InteractivePreview
One of main features, InteractivePreview provides a preset session for those who don't want to do complicated configurations.
| Features | Description | |------------------------|------------------------------------------------------------------------------------------------------------------| | Double tap to change camera | Switches between the front and back camera upon double tapping. | | Pinch zoom | Allows zooming in or out on the preview by using a pinch gesture. |
Installation
Swift Package Manager (SPM)
Follow these steps to install Aespa using SPM:
- From within Xcode 13 or later, choose
File>Swift Packages>Add Package Dependency. - At the next screen, enter the URL for the Aespa repository in the search bar then click
Next.
https://github.com/enebin/Aespa.git
- For the
Version rule, selectUp to Next Minorand specify the current Aespa version then clickNext. - On the final screen, select the
Aespalibrary and then clickFinish.
Aespa should now be integrated into your project 🚀.
Usage
Note
We offer an extensively detailed and ready-to-use code base for a SwiftUI app that showcases most of the package's

