Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
- let cell2 = collectionV.dequeueReusableCell(withReuseIdentifier: cellIdentifier, for: indexPath) as! SelectFriendCollectionViewCell
- let cell5 = self.collectionV.cellForItem(at: indexPath) as? SelectFriendCollectionViewCell
- let Friends_avatarname = (cell5?.avatarUsername_Outlet.text! as? String!)!
- let Friends_UID = (cell5?.avatarUID_Outlet.text! as? String!)!
- let Friend = FriendsSelectArray(avatarUID: (Friends_UID as! String?)!, avatarname: (Friends_avatarname as! String?)!)
- self.FriendsSelect.append(Friend)
- print ("Friend added :(Friend.avatarname)")
- }
- func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) {
- let cell2 = collectionV.dequeueReusableCell(withReuseIdentifier: cellIdentifier, for: indexPath) as! SelectFriendCollectionViewCell
- let cell5 = self.collectionV.cellForItem(at: indexPath) as? SelectFriendCollectionViewCell
- let Friends_avatarname = (cell5?.avatarUsername_Outlet.text! as? String!)!
- let Friends_UID = (cell5?.avatarUID_Outlet.text! as? String!)!
- var Friend = FriendsSelectArray(avatarUID: (Friends_UID as! String?)!, avatarname: (Friends_avatarname as! String?)!)
- }
- class FriendsSelectArray{
- var avatarUID: String
- var avatarname: String
- init( avatarUID: String, avatarname: String){
- self.avatarUID = avatarUID
- self.avatarname = avatarname
- }
- func returnPostAsDictionary()->NSDictionary{
- let postDictionary: NSDictionary = ["avatarUID": avatarUID,
- "avatarname": avatarname]
- return postDictionary
- }
- }
- class SelectFriendViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate {
- @IBOutlet weak var collectionV: UICollectionView!
- var databaseRef: DatabaseReference!
- let cellIdentifier = "cell"
- var FriendsSelect : [FriendsSelectArray] = []
- var selectedCell = [IndexPath]()
Add Comment
Please, Sign In to add comment