Skip to content

Commit

Permalink
audio fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-khashimov committed Nov 12, 2020
1 parent eeb446e commit 7cd965b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,16 @@ class SoundExampleViewController: UIViewController {
}

func rotate() {
fortuneWheel.startRotationAnimation(finishIndex: 0, continuousRotationTime: 5, nil)
fortuneWheel.startRotationAnimation(finishIndex: 0, continuousRotationTime: 2, nil)
}

@IBAction func impactFeedbackValueChanged(_ sender: UISwitch) {
fortuneWheel.impactFeedbackOn = impactFeedbackSwitch.isOn
}

@IBAction func soundEffectTypeValueChanged(_ sender: UISegmentedControl) {
fortuneWheel.stopRotation()

fortuneWheel.edgeCollisionDetectionOn = soundEffectTypeSegmentedControl.selectedSegmentIndex == 0

fortuneWheel.centerCollisionDetectionOn = soundEffectTypeSegmentedControl.selectedSegmentIndex == 1
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftFortuneWheel/SwiftFortuneWheel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public class SwiftFortuneWheel: SFWControl {
private(set) lazy var audioPlayerManager = AudioPlayerManager()

#if os(iOS)
@available(iOSApplicationExtension 10.0, *)
@available(iOS 10.0, iOSApplicationExtension 10.0, *)
private(set) lazy var impactFeedbackgenerator = UIImpactFeedbackGenerator(style: .light)
#endif

Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftFortuneWheel/Utils/Audio/AudioPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AudioPlayer {
/// - file: Audio file that will be played
/// - identifier: Sound identifier which is will start to play
func play(_ file: AVAudioFile, identifier: SoundIdentifier) {
if #available(iOSApplicationExtension 11.0, OSXApplicationExtension 10.13, tvOSApplicationExtension 11.0, *) {
if #available(iOS 11.0, iOSApplicationExtension 11.0, OSX 10.13, OSXApplicationExtension 10.13, tvOS 11.0, tvOSApplicationExtension 11.0, *) {
node.scheduleFile(file, at: nil, completionCallbackType: .dataPlayedBack) {
[weak self] callbackType in
self?.didCompletePlayback(for: identifier)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import UIKit
#if os(iOS)
/// The protocol that adds support for the impact feedback
protocol ImpactFeedbackable {
@available(iOSApplicationExtension 10.0, *)
@available(iOS 10.0, iOSApplicationExtension 10.0, *)
/// Use impact feedback to indicate that an impact has occurred
var impactFeedbackgenerator: UIImpactFeedbackGenerator { get }
/// Impact feedback on or off
Expand All @@ -27,7 +27,7 @@ protocol ImpactFeedbackable {
extension ImpactFeedbackable {
/// Prepare impact feedback if needed
func prepareImpactFeedbackIfNeeded() {
if #available(iOSApplicationExtension 10.0, *) {
if #available(iOS 10.0, iOSApplicationExtension 10.0, *) {
guard impactFeedbackOn == true else { return }
impactFeedbackgenerator.prepare()
} else {
Expand All @@ -37,7 +37,7 @@ extension ImpactFeedbackable {

/// Generates impact feedback
func impactFeedback() {
if #available(iOSApplicationExtension 10.0, *) {
if #available(iOS 10.0, iOSApplicationExtension 10.0, *) {
if impactFeedbackOn {
impactFeedbackgenerator.impactOccurred()
}
Expand Down
42 changes: 0 additions & 42 deletions Sources/SwiftFortuneWheel/Utils/Audio/ImpactFeedbacking.swift

This file was deleted.

0 comments on commit 7cd965b

Please sign in to comment.