Snippets Collections
    override func viewDidLoad() {
        super.viewDidLoad()
      
      setTermsAndConditionsLabel()
    }

  @IBAction func checkButtonPressed(_ sender: Any) {
        if check {
            checkImageView.isHidden = true
            uncheckImageView.isHidden = false
            check = false
        } else {
            checkImageView.isHidden = false
            uncheckImageView.isHidden = true
            check = true
        }
    }

@objc func tappedTermsAndConditions(_ sender: UITapGestureRecognizer) {
        if let link = URL(string: "https://www.google.com") {
            UIApplication.shared.open(link)
        }
    }
    
    func setTermsAndConditionsLabel() {
        
        let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(tappedTermsAndConditions))
        termsAndConditionsLabel.isUserInteractionEnabled = true
        termsAndConditionsLabel.addGestureRecognizer(tapGestureRecognizer)
        
        let fullText = "I agree to the Terms and Conditions"
        let attributedString = NSMutableAttributedString(string: fullText)

        let grayAttributes: [NSAttributedString.Key: Any] = [
            .foregroundColor: UIColor.gray,
        ]
        
        let boldAttributes: [NSAttributedString.Key: Any] = [
            .font: UIFont.boldSystemFont(ofSize: 17), // Replace with your desired font size
        ]

        let blueAttributes: [NSAttributedString.Key: Any] = [
            .foregroundColor: hexStringToUIColor(hex: "2563EB"),
            .underlineStyle: NSUnderlineStyle.single.rawValue,
            .link: "termsAndConditionsURL", // Replace with your actual URL
        ]

        let grayRange = (fullText as NSString).range(of: "I agree to the")
        attributedString.addAttributes(grayAttributes, range: grayRange)

        let blueRange = (fullText as NSString).range(of: "Terms and Conditions")
        attributedString.addAttributes(blueAttributes, range: blueRange)
        
        let boldRange = (fullText as NSString).range(of: "Terms and Conditions")
        attributedString.addAttributes(boldAttributes, range: boldRange)

        termsAndConditionsLabel.attributedText = attributedString
    }
#Add the new column which gives a unique number to each of these labels 

df['label_num'] = df['label'].map({
    'Household' : 0, 
    'Books': 1, 
    'Electronics': 2, 
    'Clothing & Accessories': 3
})

#checking the results 
df.head(5)
    func setBalanceLabel(_ balance: String) {
        let height = balanceLabel.layer.frame.height
        balanceLabel.text = "  " + balance + "  "
        balanceLabel.sizeToFit()
        balanceLabel.layer.frame.size.height = height
        balanceLabel.layer.cornerRadius = balanceLabel.layer.frame.height/2
    }

Save snippets that work with our extensions

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