Skip to content

Instantly share code, notes, and snippets.

View saurabh-selldo's full-sized avatar
🏠
Working from home

Saurabh Bajaj saurabh-selldo

🏠
Working from home
View GitHub Profile
@joshavant
joshavant / UITextView+HeightCalculation.swift
Created July 21, 2016 03:00
UITextView Height Calculation
extension UITextView {
// Note: This will trigger a text rendering!
func calculateViewHeightWithCurrentWidth() -> CGFloat {
let textWidth = self.frame.width -
self.textContainerInset.left -
self.textContainerInset.right -
self.textContainer.lineFragmentPadding * 2.0 -
self.contentInset.left -
self.contentInset.right
import Foundation
import UIKit
public enum UIButtonBorderSide {
case Top, Bottom, Left, Right
}
extension UIButton {
public func addBorder(side: UIButtonBorderSide, color: UIColor, width: CGFloat) {