This file contains 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 { | |
var base64encoded: String? { | |
if let data = self.data(using: .utf8) { | |
return data.base64EncodedString(options: Data.Base64EncodingOptions(rawValue: 0)) | |
} | |
return nil | |
} |
This file contains 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 randomizeArray<T>(_ arr: inout Array<T>) -> Void { | |
let maxIndex = arr.count - 1 | |
for i in 0...maxIndex { | |
arr.swapAt(i, Int(arc4random_uniform(UInt32(maxIndex + 1)))) | |
} | |
} |
This file contains 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 className(target: AnyObject) -> String { | |
let nameSpaceClassName = NSStringFromClass(type(of: target)) | |
if let className = nameSpaceClassName.components(separatedBy: ".").last { | |
return className | |
} | |
return "" | |
} |
This file contains 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 | |
fileprivate let overlayViewTag: Int = 999 | |
fileprivate let activityIndicatorViewTag: Int = 1000 | |
// Public interface | |
extension UIView { | |
func displayAnimatedActivityIndicatorView() { | |
setActivityIndicatorView() | |
} |