Files
GitHawk/Pods/StyledTextKit/Source/StyledTextRenderCacheKey.swift
2018-07-15 15:25:47 -04:00

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
}
}