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
override func viewDidLoad() { | |
super.viewDidLoad() | |
// This keep the back button after setting the left title view | |
navigationItem.leftItemsSupplementBackButton = true | |
} | |
func setLeftTitleView() { | |
let titleLabel = UILabel() |
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
override func viewWillAppear(_ animated: Bool) { | |
super.viewWillAppear(animated) | |
initNavigationBar() | |
} | |
override func viewWillDisappear(_ animated: Bool) { | |
super.viewWillDisappear(animated) | |
UIApplication.shared.statusBarStyle = .lightContent |
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
// String Extension to get based 64 signature to sign google api urls in Swift 3 | |
// FROM https://stackoverflow.com/a/20300625/5965126 | |
extension String { | |
func signatureBase64(key: String) -> String? { | |
if let signature = self.data(using: .utf8) as NSData?, let signingKey = self.decodeURLBase64String(string: key) { | |
if let digest = self.hmacSha1(data: signature, key: signingKey) { | |
return self.encodeURLBase64Data(data: digest) | |
} | |
} |
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
- (NSString *)stringFromTimeInterval:(NSTimeInterval)interval | |
{ | |
NSInteger ti = (NSInteger)interval; | |
NSInteger seconds = ti % 60; | |
NSInteger minutes = (ti / 60) % 60; | |
NSInteger hours = (ti / 3600); | |
NSString *time = nil; | |
if (hours > 0) { | |
time = [NSString stringWithFormat:@"%02i:%02i:%02i", hours, minutes, seconds]; | |
} |