So really all I am lookng to do is store:Course name:Date:Hole 1 Club used Distance.....But I would like to have this information available as a historial record of my game.
Post
Replies
Boosts
Views
Activity
Cool idea! So my question is where would the JSON file be stored on the device? Just as a file in the filesystem? Or maybe would plists be a better solution?
extension WorkotuCreationCollectionTableViewCell: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout{
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return numberOfSets
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CollectionViewCell", for: indexPath) as! CollectionViewCell
print("Array:", Constants.Other.setsFromCollectionView)
self.collectionView.isPrefetchingEnabled = false
if Constants.view_specific_workout_from_homeScrren.posted_bool == true {
cell.repsText.text = "0"
cell.weightText.text = "0"
Constants.view_specific_workout_from_homeScrren.posted_bool = false
}
cell.initialize(withDelegate: self)
cell.layer.cornerRadius = 15.0
cell.layer.borderWidth = 0.0
cell.layer.shadowColor = UIColor.black.cgColor
cell.layer.shadowOffset = CGSize(width: 0, height: 0)
cell.layer.shadowRadius = 3.0
cell.layer.shadowOpacity = 0.8
cell.layer.masksToBounds = false //<-
cell.layer.borderColor = UIColor.systemBlue.cgColor
cell.setnumber.text = ("Set " + String(indexPath.row + 1))
return cell
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: 100, height: 110)
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
Constants.WorkoutSelectionVars.indexPath = indexPath
Constants.WorkoutSelectionVars.indexPathRow = indexPath.row
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 3
}
// Search Bar Stuff Below!
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
filteredData = searchText.isEmpty ? WorkoutNameArray : WorkoutNameArray.filter({ (dat) -> Bool in
dat.range(of: searchText, options: .caseInsensitive) != nil
})
// dropButton.dataSource = filteredData
// dropButton.show()
}
// func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) {
// searchBar.setShowsCancelButton(true, animated: true)
// for ob: UIView in ((searchBar.subviews[0] )).subviews {
// if let z = ob as? UIButton {
// let btn: UIButton = z
// btn.setTitleColor(UIColor.white, for: .normal)
// }
// }
// }
func searchBarTextDidEndEditing(_ searchBar: UISearchBar) {
searchBar.showsCancelButton = false
// ------------------------------------------- //
// Trying some new stuff here - might not work //
// ------------------------------------------- //
let exerciseNumber_string = String(collectionView.tag)
let exercise_chosen = searchBar.text ?? " "
let full_concat = exercise_chosen + exerciseNumber_string
let last1 = String(full_concat.suffix(1))
for values in Constants.View_Specific_Workout.final_exercise_array {
let temp = String(values.suffix(1))
if last1 == temp {
Constants.View_Specific_Workout.final_exercise_array.removeAll { $0 == values }
}
else {
print("first element for the new exercisde")
}
}
Constants.View_Specific_Workout.final_exercise_array.append(full_concat)
print("exercise aname array is: ",Constants.View_Specific_Workout.final_exercise_array)
print("the last number of the newly added joint is:", last1)
// ------------------------------------------- //
// ------------------------------------------- //
}
func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
searchBar.resignFirstResponder()
searchBar.text = ""
filteredData = WorkoutNameArray
//dropButton.hide()
}
}
Deleted
Claude you are amazing - thank you very much. This has solved my issue (and you taught me more thsn knew before)!