Skip to content

Instantly share code, notes, and snippets.


Pasan Premaratne Pasanpr

View GitHub Profile

Keybase proof

I hereby claim:

  • I am pasanpr on github.
  • I am pasanpr ( on keybase.
  • I have a public key ASAvauER5tk6w0IcdViNjc8qtO___bDP87wojwbOYhsyXgo

To claim this, I am signing this object:

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( ^ Int(insets.left) ^ Int(insets.bottom) ^ Int(insets.right)
View blogs.txt
Bryan Irace:
Chris Eidhof:
Airspeed Velocity:
Cocoa With Love:
Ash Furrow:
Jessie Squires:
Soroush Khanlou:
Ole Begemann:
Krzysztof Zabłocki:
Pasanpr / Error.txt
Created Jun 13, 2015
Xcode build error
View Error.txt
CompileSwift normal x86_64 /Users/pasan/iOS/Swift/Projects/BookShelf/BookShelf/LoginViewController.swift
cd /Users/pasan/iOS/Swift/Projects/BookShelf
/Applications/ -frontend -c -primary-file /Users/pasan/iOS/Swift/Projects/BookShelf/BookShelf/LoginViewController.swift /Users/pasan/iOS/Swift/Frameworks/OAuthSwift/OAuthSwift/NSData+OAuthSwift.swift /Users/pasan/iOS/Swift/Projects/BookShelf/BookShelf/GoodreadsCredential.swift /Users/pasan/iOS/Swift/Projects/BookShelf/BookShelf/AppDelegate.swift /Users/pasan/iOS/Swift/Frameworks/OAuthSwift/OAuthSwift/OAuth1Swift.swift /Users/pasan/iOS/Swift/Frameworks/OAuthSwift/OAuthSwift/SHA1.swift /Users/pasan/iOS/Swift/Projects/BookShelf/BookShelf/Shelf.swift /Users/pasan/iOS/Swift/Projects/BookShelf/BookShelf/NetworkDownController.swift /Users/pasan/iOS/Swift/Frameworks/OAuthSwift/OAuthSwift/String+OAuthSwift.swift /Users/pasan/iOS/Swift/Projects/BookShelf/BookShelf/HomeViewController
Pasanpr / CoreDataStack
Created Jun 8, 2014
Moving CoreData code to separate Swift file
View CoreDataStack
// CoreDataStack.swift
// CoreDataStack
// Created by Pasan Premaratne on 6/8/14.
// Copyright (c) 2014 Pasan Premaratne. All rights reserved.
import CoreData
import Foundation
You can’t perform that action at this time.