Skip to content

Instantly share code, notes, and snippets.

Pasan Premaratne Pasanpr

Block or report user

Report or block Pasanpr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Pasanpr
Pasanpr / TextSize.swift
Created May 9, 2017 — forked from gnou/TextSize.swift
Calculate height of some text when width is fixed
View TextSize.swift
public struct TextSize {
fileprivate struct CacheEntry: Hashable {
let text: String
let font: UIFont
let width: CGFloat
let insets: UIEdgeInsets
fileprivate var hashValue: Int {
return text.hashValue ^ Int(width) ^ Int(insets.top) ^ Int(insets.left) ^ Int(insets.bottom) ^ Int(insets.right)
You can’t perform that action at this time.