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
// 1. Declare outside class definition (or in its own file). | |
// 2. UIKit must be included in file where this code is added. | |
// 3. Extends UIDevice class, thus is available anywhere in app. | |
// as per http://stackoverflow.com/a/27759550/5583117 | |
// | |
// Usage example: | |
// | |
// if UIDevice().type == .simulator { | |
// print("You're running on the simulator... boring!") | |
// } 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
// | |
// From Jody Hagins | |
// http://stackoverflow.com/questions/10091816/nsfilesystemfreesize-translating-result-into-user-friendly-display-of-mb-gb | |
// | |
// Converted to swift by phil on 30/11/2015. | |
// Copyright © 2015 PhilEagleDev. All rights reserved. | |
// | |
func prettyBytes(numBytes: Int) -> String { | |
let scale: Double = 1024 |