Looking for some advice. Developing a gym app where the user will enter reps and lbs lifted per set per exercise. The collection of SET (per exercise) is a collection view which scrolls left to right. Here is my problem – after 4 sets are added and you scroll left and right the indexPath seems to get corrupted such that set 4 might have the values from set 1. I think it has to do with reloading the visible values and reusable cells. After the 5th cell I get a crash because of a nil value in the indexPath. The data is dynamically entered by the user and can be accessed in the Constants.Other.setsFromCollectionView variable (until thst also get corrupted with te scrolling).
Really stumped on this one. Any help would be very much appreciated.
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CollectionViewCell", for: indexPath) as! CollectionViewCell
self.collectionView.isPrefetchingEnabled = false
print("Cell tag: ", cell.tag)
let i = indexPath.item / numberOfSets
let j = indexPath.item % numberOfSets
let item = j * 5+i
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
}
Post
Replies
Boosts
Views
Activity
Looking for a few newbie Core Data examples. I am trying to develop my own golf scorecard and want to use Core Data. Is this the best approach?
Evening Developers,I am developing an app that has a facial tracking element that detects eye movement. Everything seems to work well when we use a iPhone 11 but when we install it on a iPhone X the facial features appear to be offset almost like the constraints are not being recognized. The tracking and indications seem to work ok but the visual of the facial features are just off. Can help or direction to what might be causing this would be outstanding! -Bruce
Evening,We had a previous app version developed in SWIFT and XCODE which utilizes the Apple Watch and healthkit. It was build last December and was working great. We dusted it off to do some updates and now we get a few errors. The one I think is causing it not to work is:App Store Connect Operation ErrorUnsupported Key. The Info.plist of bundle Awake.app/Watch/Heart Control WatchKit App.app/PlugIns/Heart Control WatchKit Extension.appex may not contain the UIRequiredDeviceCapabilities key.If we delete this ket in the Watchkit extensions the app fails to work on the watch. ANY help would be AWESOME! What has changed - google is being ineffective in solving this one.