Ghost
(Simon Ennaimi)
1
import UIKit
import AVKit
import AVFoundation
class ViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
}
@IBOutlet weak var PowerLVLlabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func randomNumber(_ sender: Any) {
let randomNumber = Int.random(in: 1000...10000)
PowerLVLlabel.text = String(randomNumber)
if case { randomNumber; >=9000 == (true);
func playVideo() {
guard let path = Bundle.main.path(forResource: "over 9000", ofType:"mp4") else {
debugPrint("over 9000.mp4 not found")
return
}
let player = AVPlayer(url: URL(fileURLWithPath: path))
let playerController = AVPlayerViewController()
playerController.player = player
present(playerController, animated: true) {
player.play()
}
DaveZ
(David Zarzycki)
2
This is a "using swift" question. Nevertheless and as the error suggests, the code is missing a closing } is a few places.
If a compiler error message is emitted in an endless loop, then that's a bug in compiler. (Parsing incorrect code is much harder than parsing correct code, especially when scoping tokens aren't paired correctly.)
2 Likes
Nevin
3
First, welcome to the forums.
Second, please surround code excerpts with triple-backticks (```) to get proper formatting here.
Third, the line:
if case { randomNumber; >=9000 == (true);
should probably be much more simply:
if randomNumber > 9000 {
Fourth, you have a number of unmatched opening braces that need a closing brace at the end of their blocks.