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 NSUUID { | |
| public class func shortUUID() -> String { | |
| let uuid = NSUUID().UUIDString | |
| let indexOfDash = uuid.rangeOfString("-")!.startIndex | |
| return uuid.substringToIndex(indexOfDash) | |
| } | |
| } |
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 | |
| struct AppVersion { | |
| static func version() -> String? { | |
| return NSBundle.mainBundle().infoDictionary?["CFBundleShortVersionString"] as? String | |
| } | |
| static func build() -> String? { | |
| return NSBundle.mainBundle().infoDictionary?["CFBundleVersion"] as? 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
| import Alamofire | |
| import SwiftyJSON | |
| extension Request { | |
| public static func SwiftyJSONResponseSerializer( | |
| options options: NSJSONReadingOptions = .AllowFragments) | |
| -> ResponseSerializer<JSON, NSError> | |
| { | |
| return ResponseSerializer { _, _, data, error in | |
| guard error == nil else { return .Failure(error!) } |
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 UIKit | |
| class DismissSegue: UIStoryboardSegue { | |
| override func perform() { | |
| let sourceViewController = self.sourceViewController as UIViewController | |
| sourceViewController.presentingViewController?.dismissViewControllerAnimated(true, completion: nil) | |
| } | |
| } |