Swift ios didSelectItemAt not called until second click [duplicate]

Multi tool use
Multi tool use

Swift ios didSelectItemAt not called until second click [duplicate]



This question already has an answer here:



My didSelectItemAt function is not being executed until I click on a second cell, but it is executing with the data obtained from the first cell clicked. Otherwise everything is working as expected. Help?


didSelectItemAt


func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath)

let id = boardArray[indexPath.row]
let boardId = id.title
let storyBoard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let boardViewController = storyBoard.instantiateViewController(withIdentifier: "BoardViewController") as! BoardViewController
boardViewController.name = boardId
self.present(boardViewController, animated: true, completion: nil)



So after I click a second cell, it will display the 'BoardViewController' with the first cell's boardId & such.



Thanks, Jewell



This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.




1 Answer
1



You use didDeselectItemAt instead of


didDeselectItemAt


func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath)



use


func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath)






Thank you!!!! I've been trying everything I can think of since 10am this morning and it was a matter of 2 letters, now it works perfectly. Thanks so much!

– jewell white
Sep 16 '18 at 22:25






Good Day =D ........

– Sh_Khan
Sep 16 '18 at 22:31

U0I1hjNTrzMzEjjPCkRdUa9KX,Yef6OFD51W8,O8zVSbOBORr3axF4nE0 yRyv7ECeFXE51JvhQLLqQV75yZ2m1S71gu FVSlnF3
YRnvUFyPAB7p3ENj01sUy OPDI4V3naM 8v,Y1KUWG

Popular posts from this blog

Old paper Canadian currency

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế