現在、タイマーを実装し、指定の時間に画面推移をさせるという機能を作っているのですが、このようなエラーが表示され、困っています。
先月始めたばかりで、ネットの記事等を試してみましたが、解決には至らなかったので質問させていただきます。
どなたか分かる方がいらっしゃいましたら、対処法など教えていただけたら幸いです。
###エラーメッセージ
Expected '(' in argument list of function declaration Expected '{' in body of function declaration Expected declaration Invalid redeclaration of 'ProgressView()'
###エラー箇所
func ProgressView;.progress = 1.0
###エラーメッセージ
import UIKit import ObjectiveC class QuizViewController: UIViewController { @IBOutlet weak var quizNumberLabel: UILabel! @IBOutlet weak var quizTextView: UITextView! @IBOutlet weak var answerButton1: UIButton! @IBOutlet weak var answerButton2: UIButton! @IBOutlet weak var answerButton3: UIButton! @IBOutlet weak var answerButton4: UIButton! @IBOutlet weak var judgelmageView: UIImageView! @IBOutlet var timerlabel: UILabel! @IBOutlet var ProgressView: UIProgressView! var csvArray: [String] = [] var quizArray: [String] = [] var quizCount = 0 var corrctCount = 0 var selectLebel = 0 var remainingTime = 5 var quizTimer: Timer? override func viewDidLoad() { super.viewDidLoad() answerButton1.layer.cornerRadius = 15 answerButton2.layer.cornerRadius = 15 answerButton3.layer.cornerRadius = 15 answerButton4.layer.cornerRadius = 15 print("選択したのはレベル(selectLebel)") csvArray = loadCSV(fileName: "quiz(selectLebel)") csvArray.shuffle() print(csvArray) quizArray = csvArray[quizCount].components(separatedBy: ",") quizNumberLabel.text = "第(quizCount + 1)問" quizTextView.text = quizArray[0] answerButton1.setTitle(quizArray[2], for: .normal) answerButton2.setTitle(quizArray[3], for: .normal) answerButton3.setTitle(quizArray[4], for: .normal) answerButton4.setTitle(quizArray[5], for: .normal) } // Do any additional setup after loading the view. var remainingTime1 = 10 func ProgressView;.progress = 1.0 timerlabel.text = "10" quizTimer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(timeF), userInfo: nil, repeats: true) @objc func timeF() { remainingTime1 -= 1 ProgressView.progress = Float(remainingTime) / 15 timerlabel.text = String(remainingTime) if remainingTime == 0 { quizTimer!.invalidate() quizCount += 1 } } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { let scoreVC = segue.destination as! ScoreViewController scoreVC.correct = corrctCount } @IBAction func btnAction(senderr: UIButton) { quizTimer!.invalidate() if senderr.tag == Int(quizArray[1]){ print("正解") corrctCount += 1 judgelmageView.image = UIImage(named: "correct") } else { print("不正解") judgelmageView.image = UIImage(named: "incorrect") } print("スコア:(corrctCount)") judgelmageView.isHidden = false answerButton1.isEnabled = false answerButton2.isEnabled = false answerButton3.isEnabled = false answerButton4.isEnabled = false DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { self.judgelmageView.isHidden = true self.answerButton1.isEnabled = true self.answerButton2.isEnabled = true self.answerButton3.isEnabled = true self.answerButton4.isEnabled = true self.nextQuiz() self.quizTimer!.invalidate() } } func nextQuiz() { quizCount += 1 if quizCount < csvArray.count{ quizArray = csvArray[quizCount].components(separatedBy: ",") quizNumberLabel.text = "第(quizCount + 1)問" quizTextView.text = quizArray[0] answerButton1.setTitle(quizArray[2], for: .normal) answerButton2.setTitle(quizArray[3], for: .normal) answerButton3.setTitle(quizArray[4], for: .normal) answerButton4.setTitle(quizArray[5], for: .normal) } else { performSegue(withIdentifier: "toScoreVC", sender: nil) } } func loadCSV(fileName: String) -> [String] { let csvBundle = Bundle.main.path(forResource: fileName, ofType: "csv")! do{ let csvData = try String(contentsOfFile: csvBundle, encoding: String.Encoding.utf8) let lineChange = csvData.replacingOccurrences(of: "\r", with: "\n") csvArray = lineChange.components(separatedBy: "\n") csvArray.removeLast() } catch { print("エラー") } return csvArray }
###参考にさせていただいている記事→これと同じことを行いたいです。
https://kininin.blogspot.com/2019/08/iosswift_3.html