mirror of
https://github.com/lil-org/tokenary.git
synced 2024-12-13 17:44:07 +03:00
30 lines
872 B
Swift
30 lines
872 B
Swift
// Copyright © 2021 Tokenary. All rights reserved.
|
|
|
|
import UIKit
|
|
import BlockiesSwift
|
|
|
|
protocol AccountTableViewCellDelegate: AnyObject {
|
|
|
|
func didTapMoreButton(accountCell: AccountTableViewCell)
|
|
|
|
}
|
|
|
|
class AccountTableViewCell: UITableViewCell {
|
|
|
|
private weak var cellDelegate: AccountTableViewCellDelegate?
|
|
@IBOutlet weak var avatarImageView: UIImageView!
|
|
@IBOutlet weak var titleLabel: UILabel!
|
|
|
|
func setup(address: String, delegate: AccountTableViewCellDelegate) {
|
|
cellDelegate = delegate
|
|
avatarImageView.image = Blockies(seed: address.lowercased()).createImage()
|
|
let without0x = address.dropFirst(2)
|
|
titleLabel.text = without0x.prefix(4) + "..." + without0x.suffix(4)
|
|
}
|
|
|
|
@IBAction func moreButtonTapped(_ sender: Any) {
|
|
cellDelegate?.didTapMoreButton(accountCell: self)
|
|
}
|
|
|
|
}
|