mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-06-14 01:35:05 +08:00
35 lines
853 B
Swift
35 lines
853 B
Swift
//
|
|
// StyledTextKitRenderCacheKey.swift
|
|
// StyledTextKit
|
|
//
|
|
// Created by Ryan Nystrom on 12/14/17.
|
|
// Copyright © 2017 Ryan Nystrom. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
internal struct StyledTextRenderCacheKey: Hashable, Equatable {
|
|
|
|
let width: CGFloat
|
|
let attributedText: NSAttributedString
|
|
let backgroundColor: UIColor?
|
|
let maximumNumberOfLines: Int?
|
|
|
|
// MARK: Hashable
|
|
|
|
var hashValue: Int {
|
|
return width
|
|
.combineHash(with: attributedText)
|
|
}
|
|
|
|
// MARK: Equatable
|
|
|
|
public static func ==(lhs: StyledTextRenderCacheKey, rhs: StyledTextRenderCacheKey) -> Bool {
|
|
return lhs.width == rhs.width
|
|
&& lhs.attributedText == rhs.attributedText
|
|
&& lhs.backgroundColor == rhs.backgroundColor
|
|
&& lhs.maximumNumberOfLines == rhs.maximumNumberOfLines
|
|
}
|
|
|
|
}
|