RingHelper

public final class RingHelper

RingHelper provides support for playing rings and vibrations periodically.

Author

Adamas

Version

1.5.0

Date

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) -> Bool

    Parameters

    soundFileName

    The file name of the sound.

    times

    How many times the device need to ring.

    shouldVibrate

    Whether the vibration should be performed or not.

    period

    The 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) -> Bool

    Parameters

    soundID

    The ID of the system sound.

    times

    How many times the device need to ring.

    period

    The 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

    bundle

    The 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