A lightweight UIKit waveform with cyan–violet gradients, layered glow, translucent ribbons and smooth audio response. The demo combines the view with Apple's Speech framework for live transcription.
Illustrative static preview, not a device screenshot. Sample text is synthetic.
- Configurable gradient colors, glow, wave count and line widths.
- Fast attack / gentle release smoothing and bounded rendering work.
- Responsive dark demo with start/stop controls and a live transcript.
- A single microphone input feeds recognition and waveform levels.
- Permission requests only after tapping Start; recording stops when leaving the screen.
- Reduced-motion support in the demo.
The library target exports XYZWaveformView only. Speech recognition is demonstrated in XYZWaveAndVoice/VoiceInputViewController.swift. Speaker identification and biometric authentication are not implemented.
- iOS 15 or later.
- Swift Package tools 5.5 or later; an Xcode version compatible with your device's iOS.
Add https://github.com/brandy2015/XYZWaveAndVoice.git in Xcode's package dependencies. Select main to try the unreleased visual update.
pod 'XYZWaveAndVoice'The published Pod version may predate the changes on main. To try the current source:
pod 'XYZWaveAndVoice', :git => 'https://github.com/brandy2015/XYZWaveAndVoice.git', :branch => 'main'import XYZWaveAndVoice
let waveform = XYZWaveformView()
waveform.backgroundColor = .clear
waveform.waveColor = .systemCyan
waveform.secondaryColor = .systemPurple
waveform.glowIntensity = 0.65
waveform.numberOfWaves = 5
// Supply normalized microphone levels on the main thread each display frame.
waveform.updateWithLevel(0.25)
waveform.phaseShift = UIAccessibility.isReduceMotionEnabled ? 0 : -0.055The view does not schedule its own animation. Drive it with a display link or your audio UI update loop. Zero/negative wave counts and invalid sampling densities skip drawing; nonfinite audio levels are treated as silence. Rendering is capped at 24 layers and 1,024 samples per layer.
- Open
XYZWaveAndVoice.xcodeproj. The demo does not require CocoaPods installation. - Select the app target, then choose your own Team under Signing & Capabilities. Personal signing information is intentionally absent from the shared project.
- Connect and unlock your iPhone; complete the system's trust/developer setup if prompted.
- Select the iPhone as the run destination and press Run.
- Tap Start listening and grant microphone and speech permissions. The sample recognizer uses
en_US; change its locale in the controller for another language.
The included Info.plist supplies NSMicrophoneUsageDescription and NSSpeechRecognitionUsageDescription. Apps integrating the speech example must supply their own descriptions. Speech recognition may use Apple's servers; see Privacy.
Unsigned device build:
xcodebuild -project XYZWaveAndVoice.xcodeproj -scheme XYZWaveAndVoice \
-destination 'generic/platform=iOS' CODE_SIGNING_ALLOWED=NO buildOpen Package.swift in Xcode to run package tests on an installed iOS simulator. Regression tests cover valid amplitudes, invalid levels, invalid drawing settings and extreme styling values. Compilation checks do not replace a real microphone/device test.
MIT. See LICENSE.
