Snippets Collections
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        
        let indexPath1 = IndexPath(item: selectedRow, section: 0)
        
        print("abcd")
        
        if indexPath1 != indexPath && selectedRow == -1 {
            if let cell = teamsCollectionView.cellForItem(at: indexPath) as? TeamCollectionViewCell {
                cell.teamDetailsView.layer.borderColor = hexStringToUIColor(hex: "F34141").cgColor
                cell.teamDetailsView.layer.borderWidth = 2
            }
            selectedRow = indexPath.row
        } else if indexPath1 != indexPath && selectedRow != -1 {
            if let cell = teamsCollectionView.cellForItem(at: indexPath) as? TeamCollectionViewCell {
                cell.teamDetailsView.layer.borderColor = hexStringToUIColor(hex: "F34141").cgColor
                cell.teamDetailsView.layer.borderWidth = 2
            }
            
            if let cell = teamsCollectionView.cellForItem(at: indexPath1) as? TeamCollectionViewCell {
                cell.teamDetailsView.layer.borderWidth = 0
            }
            selectedRow = indexPath.row
        } else {
            if let cell = teamsCollectionView.cellForItem(at: indexPath1) as? TeamCollectionViewCell {
                print("F34142")
                cell.teamDetailsView.layer.borderWidth = 0
                selectedRow = -1
            }
        }
}
var arrData = [String]() // This is your data array
var arrSelectedIndex = [IndexPath]() // This is selected cell Index array
var selectedSkills = [String]() // This is selected cell data array

extension ViewController: UICollectionViewDelegate, UICollectionViewDataSource
{
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return arrData.count
    }

    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell : CollectionViewCell = collectionView.dequeueReusableCell(withReuseIdentifier: "CollectionViewCell", for: indexPath) as! CollectionViewCell
          if selectedSkills.contains(arrData[indexPath.row]) {
            cell.skillsView.backgroundColor = cell.skillsView.hexStringToUIColor(hex: "FEDA22")
        }
      return cell
    }
  
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        print("You selected cell #\(indexPath.item)!")
        
            if let cell = collectionView.cellForItem(at: indexPath) as? SkillsCollectionViewCell {

                let selectedCategory = subCategoriesPopUpArray[indexPath.item]

                if selectedSubCategories.contains(selectedCategory) {
                    cell.skillsView.backgroundColor = cell.skillsView.hexStringToUIColor(hex: "F0F0F0")
                    selectedSubCategories = selectedSubCategories.filter {
                        $0 != selectedCategory
                    }
                } else {
                    selectedSubCategories.append(selectedCategory)
                    cell.skillsView.backgroundColor = cell.skillsView.hexStringToUIColor(hex: "FEDA22")
                }
        }
    }
}
# here we use WHERE column_name but we don't know what is the data 
# To fetch result of given string to match in column_data we use LIKE
#syntax SELECT * FROM <table-name> WHERE <column_name> LIKE '%<data-to-fetch>%' with out
#space both sides

SELECT * FROM employees WHERE department LIKE '%Clo%';
# NOTE : %Clo% is departement feches related data which start with that string

#ref below
course_data=# SELECT * FROM employees WHERE department LIKE '%Clo%' LIMIT 10;
 employee_id | first_name | last_name  |             email             | hire_date  |    department     | gender | salary | region_id
-------------+------------+------------+-------------------------------+------------+-------------------+--------+--------+-----------
           3 | Sydney     | Symonds    | ssymonds2@hhs.gov             | 2010-05-17 | Clothing          | F      |  95313 |         4
           7 | Ardeen     | Curwood    | acurwood6@1und1.de            | 2006-02-19 | Clothing          | F      |  28995 |         7
          10 | Redford    | Roberti    |                               | 2008-07-21 | Clothing          | M      |  72225 |         7
          21 | Bernardo   | Davage     |                               | 2013-07-11 | Clothing          | M      | 124949 |         6
          38 | Edna       | Erwin      |                               | 2003-04-09 | Children Clothing | F      |  91397 |         5
          48 | Birgitta   | Stanbrooke | bstanbrooke1b@netvibes.com    | 2016-09-12 | Clothing          | F      |  77259 |         1
          54 | Verney     | McQuirk    | vmcquirk1h@ning.com           | 2012-06-17 | Clothing          | M      |  97156 |         2
          55 | Norina     | Yea        | nyea1i@cnet.com               | 2005-06-14 | Children Clothing | F      |  45959 |         1
          56 | Wilek      | Cossor     | wcossor1j@merriam-webster.com | 2014-09-17 | Children Clothing | M      |  91859 |         4
          62 | Lek        | Camplin    |                               | 2007-07-16 | Children Clothing | M      | 124190 |         6
# so the scenario is we have table called employees
# in employees table there is column called department 
# there are different departments are included in table
# now we want some department which we dont know how its spelled there so we are just
# trying to fetch the data in column which matched or containes 
# ex: word 'Clothing' is in stored in table but we dont know exactly how data spelled there
# so we try to match something like '% clo %'
# or 'C% thing %'

SELECT * FROM emploees  WHERE department like '% thing %';
# or 
SELECT * FROM employees WHERE department like 'C% thing %';

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension