SoundsKit is a simple library that lets you deal with Swift sounds easily.
Specify a file for your sound manager:
SoundsKit.file
Specify a extension file for your sound manager. The default value is mp3
:
SoundsKit.fileExtension
Creating an instance has more benefits in managing your app sounds.
Play sound:
SoundsKit.play()
Pause currently playing sound:
SoundsKit.pause()
Stop currently playing sound:
SoundsKit.stop()
Play speech in any language. The default value is "pt-BR".
SoundsKit.reproduceSpeech(_ text: String, language: String)
Enable/disable sound:
SoundsKit.setKeyAudio(true)
SoundsKit.setKeyAudio(false)
The value of SoundsKit.setKeyAudio(_ key: Bool)
property will be automatically persisted in UserDefaults
and restored on the next launch of your app.
Check enable/disable sound:
SoundsKit.audioIsOn()
There are some functions for Letrando app.
Play Background Sound Letrando ABC:
SoundsKit.playBackgroundLetrando()
Play Alert Sound Letrando ABC:
SoundsKit.playAlert()
Play Onboarding Sound Letrando ABC:
- Parameter
at
: Select the audio for each page onboarding
SoundsKit.playOnboardingLetrando(at : Int)
Control Onboarding finish Letrando ABC:
- Parameter
at
: Select the audio for each page onboarding
SoundsKit.finishOnboarding(at index: Int)
Acess for Control Onboarding finish Letrando ABC:
SoundsKit.isFinishOnboarding()
There are some functions for Formando app.
Play Background Sound Formando:
SoundsKit.playBackgroundFormando()
Play Onboarding Sound Formando:
- Parameter
at
: Select the audio for each page onboarding
SoundsKit.playOnboardingFormando(at : Int)
Play Alert Sound Formando:
SoundsKit.playAlertFormando()
- Ability to resume
- Adjusting sound volume
- Swift 5
- iOS 13.0 or later
The Swift Package Manager is a tool for managing the distribution of Swift code. Just add the url of this repo to your Package.swift
file as a dependency:
import PackageDescription
let package = Package(
name: "SoundsKit",
platforms: [.iOS(.v13)],
products: [
.library(
name: "SoundsKit",
targets: ["SoundsKit"]),
],
dependencies: [
],
targets: [
.target(
name: "SoundsKit",
dependencies: [],
path: "Sources",
resources: [.process("SoundsKit/Resources/onboarding0.wav"),
.process("SoundsKit/Resources/onboarding1.wav"),
.process("SoundsKit/Resources/onboarding2.wav"),
.process("SoundsKit/Resources/Curious_Kiddo.mp3"),
.process("SoundsKit/Resources/audio01.wav"),
.process("SoundsKit/Resources/Formando/Play_Date.mp3"),
.process("SoundsKit/Resources/Formando/audio01_Formando.mp3"),
.process("SoundsKit/Resources/Formando/onboarding0_Formando.mp3"),
.process("SoundsKit/Resources/Formando/onboarding1_Formando.mp3"),
.process("SoundsKit/Resources/Formando/onboarding2_Formando.mp3")]),
.testTarget(
name: "SoundsKitTests",
dependencies: ["SoundsKit"],
resources: [.process("Resources/corrupt.pdf"), .process("Resources/test.wav")]),
]
)
Then run swift build
and wait for SPM to install SoundsKit.
Drop the SoundsKit.swift
file into your project, link against AVFoundation.framework
and you are ready to go.
SoundsKit is licensed under the MIT License.