This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| "Africa/Abidjan", | |
| "Africa/Accra", | |
| "Africa/Addis_Ababa", | |
| "Africa/Algiers", | |
| "Africa/Asmara", | |
| "Africa/Bamako", | |
| "Africa/Bangui", | |
| "Africa/Banjul", | |
| "Africa/Bissau", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| "WAT": "Africa/Lagos", | |
| "EAT": "Africa/Addis_Ababa", | |
| "MDT": "America/Denver", | |
| "ICT": "Asia/Bangkok", | |
| "TRT": "Europe/Istanbul", | |
| "PHT": "Asia/Manila", | |
| "CAT": "Africa/Harare", | |
| "EET": "Europe/Athens", | |
| "SGT": "Asia/Singapore", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| periodicTimeObserver = player.addPeriodicTimeObserver(forInterval: CMTime(value: CMTimeValue(1), timescale: 2), queue: DispatchQueue.main) {[weak self] (progressTime) in | |
| print("periodic time: \(CMTimeGetSeconds(progressTime))") | |
| self?.updatePlaybackProgress(progressTime: progressTime) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let seekTime = PlayerPlaybackTimeFormatter.getConvertedCMTimeByProgress(player: player, progress: progressWhenSliderIsReleased) | |
| player.seek(to: seekTime, toleranceBefore: .zero, toleranceAfter: .zero) { [weak self] _ in | |
| guard let `self` = self else { return } | |
| print("Player time after seeking: \(CMTimeGetSeconds(self.player.currentTime()))") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// Used to prevent progress bar updating while manually changing progress | |
| public private(set) var isScrubbingInProgress: Bool = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if !self.playbackManager.isScrubbingInProgress { | |
| /// Do not let scrubbing interfere with periodic observer | |
| self.controlsView.setProgress(progress: Float(self.playbackManager.currentPlaybackProgress)) | |
| self.controlsView.updateCurrentTime(label: PlayerPlaybackTimeFormatter.getCurrentTimeFormatted(player: self.playbackManager.player)) /// update current time with playback current time | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private var progressBarHighlightedObserver: NSKeyValueObservation? | |
| private lazy var progressBar: UISlider = { | |
| let bar = UISlider() | |
| bar.minimumTrackTintColor = .red | |
| bar.maximumTrackTintColor = .white | |
| bar.value = 0.0 | |
| bar.isContinuous = false | |
| bar.addTarget(self, action: #selector(handleSliderChange), for: .valueChanged) | |
| self.progressBarHighlightedObserver = bar.observe(\UISlider.isTracking, options: [.old, .new]) { (_, change) in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public private(set) var isSeekInProgress = false /// Used to notify whether to update playback progress bar | |
| func manualSeekToProgress(progress: Float) { | |
| self.isSeekInProgress = true /// Mark | |
| let seekTime = PlayerPlaybackTimeFormatter.getConvertedCMTimeByProgress(player: player, progress: progress) | |
| player.seek(to: seekTime, toleranceBefore: .zero, toleranceAfter: .zero) { [weak self] _ in | |
| guard let `self` = self else { return } | |
| print("Player time after seeking: \(CMTimeGetSeconds(self.player.currentTime()))") | |
| self.isSeekInProgress = false /// Unmark |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private var button: UIButton = UIButton() | |
| button.setTitle(NSLocalizedString("other-view-controller-button", value: "Button", comment: "Action button title in Other page"), for: .normal) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ResponderViewController: UIViewController { | |
| private var redView = UIView() | |
| private var greenView = UIView() | |
| private var blueView = UIView() | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| view.subviews(redView.subviews(greenView).subviews(blueView)) |