From 225a39bc5d6c760ddb63fa9792ff7ab406ec58bb Mon Sep 17 00:00:00 2001 From: Krishna Chaitanya Amjuri Date: Sun, 21 Jul 2019 02:01:51 +0530 Subject: [PATCH] weakself removed --- Source/BMPlayer.swift | 8 ++++---- Source/BMPlayerControlView.swift | 10 +++++----- Source/BMPlayerLayerView.swift | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Source/BMPlayer.swift b/Source/BMPlayer.swift index a4445e8..dcaa4e8 100644 --- a/Source/BMPlayer.swift +++ b/Source/BMPlayer.swift @@ -424,7 +424,7 @@ extension BMPlayer: BMPlayerLayerViewDelegate { public func bmPlayer(player: BMPlayerLayerView, playerIsPlaying playing: Bool) { controlView.playStateDidChange(isPlaying: playing) weak var _self = self - delegate?.bmPlayer(player: _self!, playerIsPlaying: playing) + delegate?.bmPlayer(player: self, playerIsPlaying: playing) playStateDidChange?(player.isPlaying) } @@ -432,7 +432,7 @@ extension BMPlayer: BMPlayerLayerViewDelegate { BMPlayerManager.shared.log("loadedTimeDidChange - \(loadedDuration) - \(totalDuration)") controlView.loadedTimeDidChange(loadedDuration: loadedDuration , totalDuration: totalDuration) weak var _self = self - delegate?.bmPlayer(player: _self!, loadedTimeDidChange: loadedDuration, totalDuration: totalDuration) + delegate?.bmPlayer(player: self, loadedTimeDidChange: loadedDuration, totalDuration: totalDuration) controlView.totalDuration = totalDuration self.totalDuration = totalDuration } @@ -468,7 +468,7 @@ extension BMPlayer: BMPlayerLayerViewDelegate { } panGesture.isEnabled = state != .playedToTheEnd weak var _self = self - delegate?.bmPlayer(player: _self!, playerStateDidChange: state) + delegate?.bmPlayer(player: self, playerStateDidChange: state) } @@ -476,7 +476,7 @@ extension BMPlayer: BMPlayerLayerViewDelegate { public func bmPlayer(player: BMPlayerLayerView, playTimeDidChange currentTime: TimeInterval, totalTime: TimeInterval) { BMPlayerManager.shared.log("playTimeDidChange - \(currentTime) - \(totalTime)") weak var _self = self - delegate?.bmPlayer(player: _self!, playTimeDidChange: currentTime, totalTime: totalTime) + delegate?.bmPlayer(player: self, playTimeDidChange: currentTime, totalTime: totalTime) self.currentPosition = currentTime totalDuration = totalTime if isSliderSliding { diff --git a/Source/BMPlayerControlView.swift b/Source/BMPlayerControlView.swift index 310684f..49c82da 100644 --- a/Source/BMPlayerControlView.swift +++ b/Source/BMPlayerControlView.swift @@ -388,7 +388,7 @@ open class BMPlayerControlView: UIView { } } weak var _self = self - delegate?.controlView(controlView: _self!, didPressButton: button) + delegate?.controlView(controlView: self, didPressButton: button) } /** @@ -408,7 +408,7 @@ open class BMPlayerControlView: UIView { // MARK: - handle UI slider actions @objc func progressSliderTouchBegan(_ sender: UISlider) { weak var _self = self - delegate?.controlView(controlView: _self!, slider: sender, onSliderEvent: .touchDown) + delegate?.controlView(controlView: self, slider: sender, onSliderEvent: .touchDown) } @objc func progressSliderValueChanged(_ sender: UISlider) { @@ -417,13 +417,13 @@ open class BMPlayerControlView: UIView { let currentTime = Double(sender.value) * totalDuration currentTimeLabel.text = BMPlayer.formatSecondsToString(currentTime) weak var _self = self - delegate?.controlView(controlView: _self!, slider: sender, onSliderEvent: .valueChanged) + delegate?.controlView(controlView: self, slider: sender, onSliderEvent: .valueChanged) } @objc func progressSliderTouchEnded(_ sender: UISlider) { autoFadeOutControlViewWithAnimation() weak var _self = self - delegate?.controlView(controlView: _self!, slider: sender, onSliderEvent: .touchUpInside) + delegate?.controlView(controlView: self, slider: sender, onSliderEvent: .touchUpInside) } @@ -451,7 +451,7 @@ open class BMPlayerControlView: UIView { if selectedIndex != button.tag { selectedIndex = button.tag weak var _self = self - delegate?.controlView(controlView: _self!, didChooseDefition: button.tag) + delegate?.controlView(controlView: self, didChooseDefition: button.tag) } prepareChooseDefinitionView() } diff --git a/Source/BMPlayerLayerView.swift b/Source/BMPlayerLayerView.swift index 0096131..5c3af78 100644 --- a/Source/BMPlayerLayerView.swift +++ b/Source/BMPlayerLayerView.swift @@ -83,7 +83,7 @@ open class BMPlayerLayerView: UIView { didSet { if oldValue != isPlaying { weak var _self = self - delegate?.bmPlayer(player: _self!, playerIsPlaying: isPlaying) + delegate?.bmPlayer(player: self, playerIsPlaying: isPlaying) } } } @@ -109,7 +109,7 @@ open class BMPlayerLayerView: UIView { didSet { if state != oldValue { weak var _self = self - delegate?.bmPlayer(player: _self!, playerStateDidChange: state) + delegate?.bmPlayer(player: self, playerStateDidChange: state) } } } @@ -304,7 +304,7 @@ open class BMPlayerLayerView: UIView { let currentTime = CMTimeGetSeconds(self.player!.currentTime()) let totalTime = TimeInterval(playerItem.duration.value) / TimeInterval(playerItem.duration.timescale) weak var _self = self - delegate?.bmPlayer(player: _self!, playTimeDidChange: currentTime, totalTime: totalTime) + delegate?.bmPlayer(player: self, playTimeDidChange: currentTime, totalTime: totalTime) } updateStatus(inclodeLoading: true) } @@ -344,7 +344,7 @@ open class BMPlayerLayerView: UIView { if state != .playedToTheEnd { if let playerItem = playerItem { weak var _self = self - delegate?.bmPlayer(player: _self!, + delegate?.bmPlayer(player: self, playTimeDidChange: CMTimeGetSeconds(playerItem.duration), totalTime: CMTimeGetSeconds(playerItem.duration)) } @@ -385,7 +385,7 @@ open class BMPlayerLayerView: UIView { let duration = item.duration let totalDuration = CMTimeGetSeconds(duration) weak var _self = self - delegate?.bmPlayer(player: _self!, loadedTimeDidChange: timeInterVarl, totalDuration: totalDuration) + delegate?.bmPlayer(player: self, loadedTimeDidChange: timeInterVarl, totalDuration: totalDuration) } case "playbackBufferEmpty":