Files
2022-05-27 20:21:01 +03:00

44 lines
1.2 KiB
Swift

//
// AccountSearchCell.swift
// PayCash
//
// Created by Alexandr Serpokrylow on 14.02.2022.
// Copyright © 2022 AM. All rights reserved.
//
import Foundation
import UIKit
class SearchAccountCell: UITableViewCell {
@IBOutlet weak var usernameLabel: UILabel!
@IBOutlet weak var permissionLabel: UILabel!
@IBOutlet weak var checkBoxButton: UIButton!
override func awakeFromNib() {
super.awakeFromNib()
selectionStyle = .none
}
func configureView(account: Account.Model.Add) {
usernameLabel.lzText = account.username
permissionLabel.lzText = "@\(account.permission.permName)"
isUserInteractionEnabled = !account.isAdded
selectAccount(isSelected: account.isChecked, isAdded: account.isAdded)
}
func selectAccount(isSelected: Bool, isAdded: Bool) {
if isAdded {
checkBoxButton.setImage(Asset.checkboxOn.image, for: .normal)
checkBoxButton.alpha = 0.4
} else if isSelected {
checkBoxButton.setImage(Asset.checkboxOn.image, for: .normal)
checkBoxButton.alpha = 1
} else {
checkBoxButton.setImage(Asset.checkboxOff.image, for: .normal)
checkBoxButton.alpha = 1
}
}
}