Archived
1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
gallery/Gallery/TagViewController.swift

33 lines
1 KiB
Swift
Raw Normal View History

2020-02-18 06:57:35 -05:00
import UIKit
import CoreData
class TagViewController: UIViewController {
var tag: String?
var collectionManager: PostsManager?
@IBOutlet weak var collectionView: UICollectionView!
2020-02-18 06:57:35 -05:00
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
collectionManager = PostsManager(collectionView: collectionView, tag: nil)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
collectionManager?.setTag(tag: self.tag)
2020-02-18 06:57:35 -05:00
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "showPost" {
let newViewController = segue.destination as! PostViewController
let index = self.collectionView.indexPathsForSelectedItems?.first
newViewController.post = self.collectionManager?.posts[index!.row]
2020-02-18 06:57:35 -05:00
newViewController.image = (self.collectionView.cellForItem(at: index!) as! PostViewCell).imageView.image;
}
}
}