CopyPastor

Detecting plagiarism made easy.

Score: 0.8057827949523926; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2024-10-22
by shah0651

Original Post

Original - Posted on 2018-02-06
by Soma Sharma



            
Present in both answers; Present only in the new answer; Present only in the old answer;

**Swift 5, Xcode 14**
import UIKit import AVFoundation class ViewController: UIViewController { var player: AVAudioPlayer! override func viewDidLoad() { super.viewDidLoad() } @IBAction func keyPressed(_ sender: UIButton) { playSound() } func playSound() { let url = Bundle.main.url(forResource: "C", withExtension: "wav") player = try! AVAudioPlayer(contentsOf: url!) player.play() } }
//Swift 4 import UIKit import AVFoundation class ViewController: UIViewController { var player : AVAudioPlayer? override func viewDidLoad() { super.viewDidLoad() } @IBAction func notePressed(_ sender: UIButton) { let path = Bundle.main.path(forResource: "note1", ofType: "wav")! let url = URL(fileURLWithPath: path) do { player = try AVAudioPlayer(contentsOf: url) player?.play() } catch { // error message } } }


        
Present in both answers; Present only in the new answer; Present only in the old answer;