RingHelper
public final class RingHelper
RingHelper provides support for playing rings and vibrations periodically.
Version
1.5.0Date
08/05/2018-
Play a customized.
Declaration
Swift
@discardableResult public func ring(withSound soundFileName: String, forTimes times: Int = defaultRingTime, withVibration shouldVibrate: Bool = true, withPeriod period: Double = defaultRingPeriod) -> BoolParameters
soundFileNameThe file name of the sound.
timesHow many times the device need to ring.
shouldVibrateWhether the vibration should be performed or not.
periodThe period between two vibrations or rings.
Return Value
Whether the ring will be performed or not. False if a ring is being played or the sound file doesn’t exist.
-
Play a system sound. Vibration is decided based on system setting.
Declaration
Swift
@discardableResult public func ring(withSoundID soundID: SystemSoundID = defaultSoundID, forTimes times: Int = defaultRingTime, withPeriod period: Double = defaultRingPeriod) -> BoolParameters
soundIDThe ID of the system sound.
timesHow many times the device need to ring.
periodThe period between two vibrations or rings.
Return Value
Whether the ring will be performed or not. False if a ring is being played.
-
Initialize the object
Declaration
Swift
public init(bundle: Bundle = Bundle.main)Parameters
bundleThe bundle where the ring file existing in.
-
The default ring time.
Declaration
Swift
static let defaultRingTime: Int -
The default period between two rings or vibrations.
Declaration
Swift
static let defaultRingPeriod: Double -
The system sound.
Declaration
Swift
static let defaultSoundID: SystemSoundID
RingHelper Class Reference