How to install .ipa files to ios in kali linux?

I downloaded the cydia impactor for linux to my kali machine. But when i try to open it this message appears:

root@kali:~/Desktop/CYDIAIMPACTOR# ./Impactor

./Impactor: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory

Is there a way to fix this or try another method of installing .ipas for jailbreaking

Go to Source
Author: ICY Counter-Strike and League

Hide customs section when no result

I have two sections header the first section is the assessments list and the second section companies list. I am trying to hide the section header when the result of the filter arrays are empty. if you see the photo I have a bug where sections headers are shown. how to fix my code and how to organize it?enter image description here

class HubTableViewController: UITableViewController, UISearchBarDelegate {

    // MARK: - Table view data source
    
    override func numberOfSections(in tableView: UITableView) -> Int {
        var numberOfsections = 0
        if isSearching {
            numberOfsections = 2
            
        }
        else {
            numberOfsections = 2
        }
        return numberOfsections
    }

    
    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        if (self.isSearching ){
            
            switch Device.size() {
            case .screen4_7Inch:
                if section == 0{
                    return  filteredAssessments!.count
                }
                else {
                    return filteredCompanies!.count
                }

            default:
                if section == 0{
                    return  filteredAssessments!.count
                }
                else {
                    return filteredCompanies!.count
                }
            }
        }
        else {
            switch Device.size() {
            case .screen4_7Inch:
                if section == 0{
                    return 3
                }
                else {
                    return 3
                }

            default:
                if section == 0{
                    return 3//    return  filteredAssessments!.count
                }
                else {
                    return 3//  return filteredCompanies!.count
                }
            }
            
        }
    }
    
    func addDoneButtonOnKeyboard() {
        
        let doneToolbar: UIToolbar = UIToolbar(frame: CGRect.init(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 50))
        doneToolbar.barStyle = .default
        
        let flexSpace = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
        let done: UIBarButtonItem = UIBarButtonItem(title: "Done", style: .done, target: self, action: #selector(self.doneButtonAction))
        
        let items = [flexSpace, done]
        doneToolbar.items = items
        doneToolbar.sizeToFit()
        
        searchBar.inputAccessoryView = doneToolbar
    }
    
    @objc func doneButtonAction(){
        noResultView.removeFromSuperview()
        self.searchBar.resignFirstResponder()
    }
    
    
    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
 
        if isSearching {
            if indexPath.section == 0{
                let cell = tableView.dequeueReusableCell(withIdentifier: "assessmentCell", for: indexPath) as! AssessmentsTableViewCell
                if let a = filteredAssessments?[indexPath.row]{
                    cell.setlblAssessmentName(a.assessmentName)
                    cell.setlblAssessmentsType(a.assessmenType)
                    cell.setlblBalance(a.balance)
                }
                return cell
            }else {
                let cell = tableView.dequeueReusableCell(withIdentifier: "companyCell", for: indexPath) as! CompanyTableViewCell
                if let c = filteredCompanies?[indexPath.row]{
                    cell.setLblCompanyName(c.companyName)
                    cell.setLblNumberOfUsers(c.numberofUser)
                }
                return cell
            }
        }
        else {
            
            if indexPath.section == 0{
                let cell = tableView.dequeueReusableCell(withIdentifier: "assessmentCell", for: indexPath) as! AssessmentsTableViewCell
                if let a = assessments?[indexPath.row]{
                    cell.setlblAssessmentName(a.assessmentName)
                    cell.setlblAssessmentsType(a.assessmenType)
                    cell.setlblBalance(a.balance)
                }
                return cell
            }else {
                let cell = tableView.dequeueReusableCell(withIdentifier: "companyCell", for: indexPath) as! CompanyTableViewCell
                if let c = companies?[indexPath.row]{
                    cell.setLblCompanyName(c.companyName)
                    cell.setLblNumberOfUsers(c.numberofUser)
                }
                return cell
            }
        }
    }
    
    
    
    override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {

            if (section == 0){
                
                let view = tableView.dequeueReusableHeaderFooterView(withIdentifier:
                    "sectionHeader") as! HubCustomHeader
                view.title.text = "My Balances"
                view.button.setTitle("VIEW ALL", for: .normal)
                
                return view
                
            }
            else {
                let view = tableView.dequeueReusableHeaderFooterView(withIdentifier:
                    "sectionHeader") as! HubCustomHeader
                view.title.text = "My Customers"
                view.button.setTitle("ADD", for: .normal)
                return view
            }
        
    }
    
    override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        if section ==  0{
            return 50
        }
        else {
            
            return 50
        }
    }
    
    func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
        if searchBar.text == "" {
            isSearching = false
            noResultView.removeFromSuperview()
            hubtableView.reloadData()
        } else {
            isSearching = true
            filteredAssessments = self.assessments?.filter {
                $0.assessmentName.range(of: searchText, options: .caseInsensitive)  != nil
            }
           
            filteredCompanies = self.companies?.filter {
                $0.companyName.range(of: searchText, options: .caseInsensitive)  != nil
            }
         hubtableView.reloadData()
            if(filteredCompanies!.isEmpty   ||  filteredCompanies!.isEmpty ){
                view.backgroundColor = UIColor.white
                view.addSubview(noResultView)
                noResultView.center = view.center
                self.hubtableView.reloadData()
                hubtableView.separatorStyle = .none
            }
            else
            {
                tableView.reloadData()
            }
        }
    }
  
}

Go to Source
Author: developer16

How to add Multiple Section UICollectionViewCells in one view

I’m trying to build multiple section uicollectionview in the same view the first collection view working fine but when I added the second one the app crashed (lldb),
both are custom cells define a suprate classes i used if statement as showing in this Answer: https://stackoverflow.com/a/44692356/8386142?stw=2 the code is clear no errors it just crashed like there is something wrong with constraints (lldb)
here is the code that I used to build it the

import UIKit

struct areaCustomCellData {
    var lable: String
}

struct storesCustomCellData {
    var lable: String
}

class Search: UIViewController {

    let data = [
     areaCustomCellData(lable: "شرق النيل"),
     areaCustomCellData(lable: "بحري"),
     areaCustomCellData(lable: "امدرمان"),
     areaCustomCellData(lable: "الخرطوم"),
    ]

    let storesData = [
     storesCustomCellData(lable: "شرق النيل"),
     storesCustomCellData(lable: "بحري"),
     storesCustomCellData(lable: "امدرمان"),
     storesCustomCellData(lable: "الخرطوم"),
    ]

    let areaCView: UICollectionView = {
       let layout = UICollectionViewFlowLayout()
        layout.scrollDirection = .horizontal
       let cv = UICollectionView(frame: .zero, collectionViewLayout: layout)
        cv.translatesAutoresizingMaskIntoConstraints = false
        cv.register(customCell.self, forCellWithReuseIdentifier: "areaCell")
        cv.backgroundColor = UIColor(red: 245, green: 245, blue: 245, a: 1)
        cv.showsHorizontalScrollIndicator = false
       return cv
    }()

    let storesCView: UICollectionView = {
       let layout = UICollectionViewFlowLayout()
        layout.scrollDirection = .vertical
       let cv = UICollectionView(frame: .zero, collectionViewLayout: layout)
        cv.translatesAutoresizingMaskIntoConstraints = false
        cv.register(customCell2.self, forCellWithReuseIdentifier: "storesCell")
        cv.backgroundColor = UIColor(red: 245, green: 245, blue: 245, a: 1)
        cv.showsVerticalScrollIndicator = false
       return cv
    }()

    override func viewDidLoad() {
        super.viewDidLoad()

        self.view.backgroundColor = UIColor(red: 245, green: 245, blue: 245, a: 1)
        view.addSubview(areaCView)
        view.addSubview(storesCView)

        storesCView.delegate = self
        storesCView.dataSource = self
        areaCView.delegate = self
        areaCView.dataSource = self

        setUpLayout()
        setUpNavBar()
        setUpSearchBar()

    }

    func setUpLayout(){
        areaCView.topAnchor.constraint(equalTo: view.topAnchor, constant: 120).isActive = true
        areaCView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
        areaCView.trailingAnchor.constraint(equalTo: view.trailingAnchor,constant: -20).isActive = true
        areaCView.heightAnchor.constraint(equalToConstant: 30).isActive = true

        storesCView.topAnchor.constraint(equalTo: view.topAnchor, constant: 500).isActive = true
        storesCView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
        storesCView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
        storesCView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true

    }

extension Search: UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
        if indexPath.section == 0 {
           return CGSize(width: collectionView.frame.width/4, height: collectionView.frame.height)

        }else {
        return CGSize(width: collectionView.frame.width/4, height: collectionView.frame.height)
        }
    }

    func numberOfSections(in collectionView: UICollectionView) -> Int {
        return 2
    }

    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return (section == 0) ? data.count : storesData.count
    }

    func collectionView(_ collectionView: UICollectionView, cellForItemAt
        indexPath: IndexPath) -> UICollectionViewCell {
        if indexPath.section == 0 {
            let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "areaCell", for: indexPath) as! customCell
            cell.data = self.data[indexPath.row]
            cell.backgroundColor = UIColor.white
            cell.layer.cornerRadius = 10
            return cell

        }else{
            let cell2 = collectionView.dequeueReusableCell(withReuseIdentifier: "storesCell", for: indexPath) as! customCell2
            cell2.storesData = self.storesData[indexPath.row]
            cell2.backgroundColor = UIColor.white
            cell2.layer.cornerRadius = 10
            return cell2
        }


    }

}


class customCell: UICollectionViewCell {

    var data: areaCustomCellData? {
        didSet{
            guard let data = data else {return}

            areaLable.text = data.lable
        }
    }

    let areaLable: UILabel = {
       let lable = UILabel()
        lable.text = "الخرطوم"
        lable.font = .systemFont(ofSize: 12)
        lable.contentMode = .scaleAspectFit
        lable.clipsToBounds = true
        lable.textAlignment = .center
        lable.translatesAutoresizingMaskIntoConstraints = false
        return lable

    }()

    override init(frame: CGRect) {
        super.init(frame: frame)
        contentView.addSubview(areaLable)

        areaLable.topAnchor.constraint(equalTo: contentView.topAnchor).isActive = true
        areaLable.leadingAnchor.constraint(equalTo: contentView.leadingAnchor).isActive = true
        areaLable.trailingAnchor.constraint(equalTo: contentView.trailingAnchor).isActive = true
        areaLable.bottomAnchor.constraint(equalTo: contentView.bottomAnchor).isActive = true
    }

    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

class customCell2: UICollectionViewCell {

    var storesData: storesCustomCellData? {
        didSet{
            guard let storesData = storesData else {return}

            storesLable.text = storesData.lable
        }
    }

    let storesLable: UILabel = {
       let lable = UILabel()
        lable.text = "الخرطوم"
        lable.font = .systemFont(ofSize: 12)
        lable.contentMode = .scaleAspectFit
        lable.clipsToBounds = true
        lable.textAlignment = .center
        lable.translatesAutoresizingMaskIntoConstraints = false
        return lable

    }()

    override init(frame: CGRect) {
        super.init(frame: frame)

        contentView.addSubview(storesLable)
        storesLable.topAnchor.constraint(equalTo: contentView.topAnchor).isActive = true
        storesLable.leadingAnchor.constraint(equalTo: contentView.leadingAnchor).isActive = true
        storesLable.trailingAnchor.constraint(equalTo: contentView.trailingAnchor).isActive = true
        storesLable.bottomAnchor.constraint(equalTo: contentView.bottomAnchor).isActive = true
    }

    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

Go to Source
Author: mazenqp

How to get center point (CGPoint) of a UIView that has been set using autolayout

So I haven’t seen any other SO question about this. Basically, I have set a UIView with autolayout, programmatically.

The issue occurs when I try to create a UIBezierPath:

let circularPath = UIBezierPath(arcCenter: myView.center, radius: (91*(1.2))/2 - (8/2), startAngle: -CGFloat.pi / 2, endAngle: 2 * CGFloat.pi, clockwise: true)

The issue is that the myView.center prints out: 0.0, 0.0 since I did not set a CGRect .frame for the myView, and instead used autolayout (which is below):

NSLayoutConstraint.activate([
    myView.heightAnchor.constraint(equalToConstant: 91),
    myView.widthAnchor.constraint(equalToConstant: 91),
    myView.centerXAnchor.constraint(equalToSystemSpacingAfter: myButton.centerXAnchor, multiplier: 1),
    myView.centerYAnchor.constraint(equalToSystemSpacingBelow: myButton.centerYAnchor, multiplier: 1),
])

and also perhaps I should note that myView is added as a subview of myButton (though this shouldn’t really matter..)

So how do I make this work? how could I get the .center (a type CGPoint) to use in the UIBezierPath? THANKS!

Go to Source
Author: GEO G