As funções de chamada UICollectionViewcell repetidamente

Eu tenho esse uicollectionviewcell

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell
{
    let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellId, for: indexPath) as! PostCell
    if let CurrentPost = posts[indexPath.row] as? Post{
        //determine which constraint to call
        if(CurrentPost.PostText != nil){
            if(CurrentPost.PostImage != nil){
                cell.postImage.image = CurrentPost.PostImage
                cell.cellConstraintsWithImageWithText()
            }else{
                cell.postImage.image = nil
                cell.cellConstraintsWithoutImageWithText()
            }
        }else{
            cell.postImage.image = CurrentPost.PostImage
            cell.cellConstraintsWithImageWithoutText()
        }
    }
    return cell
}

Meu objetivo é determinar qual função atingir com base na ausência ou presença de imagem e texto. Agora, o problema é que todas essas funções são chamadas porque algumas células têm imagenscellConstraintsWithImageWithText está sendo chamado, outros não os têmcellConstraintsWithoutImageWithText está sendo chamado.Como posso chamar uma única função para uma única célula em vez de todas as células?

questionAnswers(1)

yourAnswerToTheQuestion