This code below prints all of the entries of coreData on a label.
var users = [User]()
override func viewDidLoad() {
super.viewDidLoad()
if cdHandler.fetchObject() != nil {
users = cdHandler.fetchObject()!
for c in users {
drj.text = "\((drj.text)!)+\((c.userName)!)"
}
}
}
I want to do the same thing on a collection view cell label. I want to print a single entry on a collection view label in the collection view cell.
COLLECTIONVIEWCELL
import UIKit
class whyCollectionViewCell: UICollectionViewCell {
@IBOutlet var general: UILabel!
}
COLLECTIONVIEWVIEWCONTROLLER
import UIKit
class collectionVIEW: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate {
var users = [User]()
@IBOutlet var theIssues: UICollectionView!
override func viewDidLoad() {
super.viewDidLoad()
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
}
}