mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-06-02 06:30:26 +08:00
40 lines
1.1 KiB
Swift
40 lines
1.1 KiB
Swift
//
|
|
// IssueFilesTableCell.swift
|
|
// Freetime
|
|
//
|
|
// Created by Ryan Nystrom on 8/12/17.
|
|
// Copyright © 2017 Ryan Nystrom. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
final class IssueFilesTableCell: UITableViewCell {
|
|
|
|
@IBOutlet weak var changeLabel: UILabel!
|
|
@IBOutlet weak var pathLabel: UILabel!
|
|
|
|
// MARK: Public API
|
|
|
|
func configure(path: String, additions: Int, deletions: Int) {
|
|
let changeString = NSMutableAttributedString()
|
|
var attributes: [String: Any] = [
|
|
NSFontAttributeName: Styles.Fonts.secondaryBold,
|
|
]
|
|
|
|
if additions > 0 {
|
|
attributes[NSForegroundColorAttributeName] = Styles.Colors.Green.medium.color
|
|
changeString.append(NSAttributedString(string: "+\(additions) ", attributes: attributes))
|
|
}
|
|
|
|
if deletions > 0 {
|
|
attributes[NSForegroundColorAttributeName] = Styles.Colors.Red.medium.color
|
|
changeString.append(NSAttributedString(string: "-\(deletions)", attributes: attributes))
|
|
}
|
|
|
|
changeLabel.attributedText = changeString
|
|
|
|
pathLabel.text = path
|
|
}
|
|
|
|
}
|