This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func appendToPath(path: CGMutablePath) | |
{ | |
let textPath = CGPathCreateMutable() | |
let attributedString = NSAttributedString(string: string) | |
let line = CTLineCreateWithAttributedString(attributedString) | |
// direct cast to typed array fails for some reason | |
let runs = (CTLineGetGlyphRuns(line) as [AnyObject]) as! [CTRun] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for page in pages ?? [] | |
{ | |
guard let pageNumber = page.pageNumber | |
else { continue } | |
if let array = pageLookup[pageNumber] | |
{ | |
pageLookup[pageNumber] = array + [page] | |
} | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
modified = @"Fri, 02 Oct 2015 16:20:34 CEST"; | |
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
[dateFormatter setDateFormat:@"EEE, dd MMM yyyy HH:mm:ss zzz"]; | |
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]; | |
[dateFormatter setLocale:locale]; | |
_lastModifiedDate = [dateFormatter dateFromString:modified]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// HeroRaysView.swift | |
// HeroRays | |
// | |
// Created by Oliver Drobnik on 08/11/15. | |
// Copyright © 2015 Oliver Drobnik. All rights reserved. | |
// | |
import UIKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
public class UploadProgress: NSProgress | |
{ | |
var sessionTask: NSURLSessionTask! | |
required public init(sessionTask: NSURLSessionTask) | |
{ | |
super.init(parent: nil, userInfo: nil) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Entity: NSObject | |
{ | |
var objectID: String? | |
var createdAt: NSDate? | |
var updatedAt: NSDate? | |
required override init() | |
{ | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func classForName(name: String) -> AnyClass | |
{ | |
// build namespaced name | |
let namespacedName = "Module." + name | |
return NSClassFromString(namespacedName)! | |
} | |
func nameForType<T where T: Entity>(type: T.Type) -> String | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Entity | |
{ | |
var objectID: String? | |
var createdAt: NSDate? | |
var updatedAt: NSDate? | |
var avatarURL: NSURL? | |
var wallpaperURL: NSURL? | |
required init() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
func checkIt(nameString: String, dictionary: [String: String]) -> Bool | |
{ | |
let namePieces = nameString.componentsSeparatedByString("/") | |
guard namePieces.count > 2, | |
let urlString = dictionary["url"], | |
url = NSURL(string: urlString), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension String | |
{ | |
func isSomeText() -> Bool | |
{ | |
if count(self)>0 | |
{ | |
return true | |
} | |
return false |