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
2020-02-18 06:57:35 -05:00

25 lines
869 B
Swift

import UIKit
import CoreData
class TagViewController: UIViewController {
var tag: String?
@IBOutlet weak var collectionView: PostCollectionView!
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
collectionView.actualInit(tag: self.tag)
collectionView.viewController = self
}
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.collectionView.posts[index!.row]
newViewController.image = (self.collectionView.cellForItem(at: index!) as! PostViewCell).imageView.image;
}
}
}