- iOS 15.0+
- Xcode 26.0+ (Liquid Glass style requires iOS 26; earlier systems fall back to the classic style)
- Swift 6.0+
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.
Once you have your Swift package set up, adding CameraButton as a dependency is as easy as adding it to the dependencies value of your Package.swift or the Package list in Xcode.
dependencies: [
.package(url: "https://github.com/Ramiz69/CameraButton.git", .upToNextMajor(from: "1.0.0"))
]Normally you'll want to depend on the CameraButton target:
.product(name: "CameraButton", package: "CameraButton")CocoaPods is no longer supported starting with 1.0.0. The last published pod is RKCameraButton 0.0.4. Please migrate to Swift Package Manager.
Copy the contents of the Sources folder into your project.
let button = CameraButton()
button.type = .video // .photo or .video
button.style = .glass // Liquid Glass on iOS 26+, classic ring otherwise
button.delegate = self
view.addSubview(button) // 60×60 intrinsic size, or constrain itIn storyboards, add a button and set its class to CameraButton in the Identity Inspector.
@State private var isRecording = false
CameraShutterButton(type: .video, style: .glass, isRecording: $isRecording) {
isRecording ? recorder.start() : recorder.stop()
}
.frame(width: 72, height: 72)CameraShutterButton is a thin wrapper over the same CameraButton, so both share one implementation.
button.animateRecordingProgress(duration: 15) // fills the ring over the max clip length
button.recordingProgress = 0.4 // or drive it manuallyThe ring resets when recording stops.
| Property | Description |
|---|---|
style |
.classic or .glass |
glassTintColor |
Tint of the glass disc |
photoColor, videoColor |
Fill of the inner shape |
ringColor, ringLineWidth, ringOffset |
Classic ring appearance |
progressColor |
Recording ring color |
isHapticFeedbackEnabled |
Haptics on capture and record toggle |
The button supports VoiceOver labels, Dynamic colors and Reduce Motion out of the box.
Open CameraButton.xcodeproj and run the CameraButton-Example scheme (iOS 18+). It is a SwiftUI camera screen with:
- a live camera preview on device and an animated scene in the Simulator;
- photo and video modes with a recording timer and a 15 s limit;
- a Playground sheet that edits every button property live and shows the matching Swift code;
- a SwiftUI / UIKit switch that renders the same button through
CameraShutterButtonor throughCameraButtonwith a delegate.
ramiz69, ramiz161@icloud.com
CameraButton is available under the MIT license. See LICENSE for details.
