-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f386e3a
commit ac1ec7b
Showing
23 changed files
with
229 additions
and
57 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// HighScoresViewController.swift | ||
// SoundboardQuiz | ||
// | ||
// Created by Luke A Aschenbrenner on 5/2/23. | ||
// | ||
|
||
import UIKit | ||
|
||
class HighScoresViewController: UIViewController { | ||
|
||
@IBOutlet weak var score1: UILabel! | ||
@IBOutlet weak var score2: UILabel! | ||
@IBOutlet weak var score3: UILabel! | ||
@IBOutlet weak var score4: UILabel! | ||
@IBOutlet weak var score5: UILabel! | ||
private var scoreArray: [UILabel]? | ||
//private var tupleArray: [(String, String)] = [] | ||
|
||
override func viewDidLoad() { | ||
scoreArray = [score1, score2, score3, score4, score5] | ||
super.viewDidLoad() | ||
// let defaults = UserDefaults.standard | ||
//let highScoresArr: Array<(String, Int)>? = defaults.array(forKey: "highScores") as? Array<(String, Int)> | ||
let fetchedData = UserDefaults.standard.data(forKey: "highScores")! | ||
let highScoresArr = try? PropertyListDecoder().decode([MyTuple].self, from: fetchedData) | ||
// highScoresDict?.forEach({ | ||
// | ||
// let (gameType, score) = $0 | ||
// let scoreString = score as! Int | ||
// tupleArray.append((gameType, scoreString)) | ||
// | ||
// }) | ||
if let scoreArray, let highScoresArr{ | ||
var i = 0 | ||
for myTuple in highScoresArr[0..<min(5, highScoresArr.endIndex)]{ | ||
scoreArray[i].text? = "\(myTuple.score) (\(myTuple.categoryName))" | ||
i += 1 | ||
} | ||
if(i < scoreArray.count){ | ||
while(i < scoreArray.count){ | ||
scoreArray[i].text? = "N/A" | ||
i += 1 | ||
} | ||
} | ||
}else{ | ||
var i = 1 | ||
for label in scoreArray!{ | ||
label.text = "N/A" | ||
i += 1 | ||
} | ||
} | ||
|
||
|
||
|
||
// Do any additional setup after loading the view. | ||
} | ||
|
||
|
||
/* | ||
// MARK: - Navigation | ||
|
||
// In a storyboard-based application, you will often want to do a little preparation before navigation | ||
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { | ||
// Get the new view controller using segue.destination. | ||
// Pass the selected object to the new view controller. | ||
} | ||
*/ | ||
|
||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains 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