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
class MyCell: UITableViewCell { | |
init() { | |
// Initialize... | |
accessoryView = UIView() | |
accessoryView?.translatesAutoresizingMaskIntoConstraints = false | |
addSubview(accessoryView!) |
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
class ChildViewController: UIViewController { | |
func addSwipeGesture() { | |
let leftGestureRecognizer = UISwipeGestureRecognizer(target: self, action: #selector(swipe)) | |
let rightGestureRecognizer = UISwipeGestureRecognizer(target: self, action: #selector(swipe)) | |
leftGestureRecognizer.delegate = self | |
rightGestureRecognizer.delegate = self | |
leftGestureRecognizer.direction = UISwipeGestureRecognizerDirection.left | |
rightGestureRecognizer.direction = UISwipeGestureRecognizerDirection.right |
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
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 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
Build Phases -> Add Build Phase -> Copy Bundle Resources | |
Add json file there |
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
override func viewWillAppear(_ animated: Bool) { | |
super.viewWillAppear(animated) | |
initNavigationBar() | |
} | |
override func viewWillDisappear(_ animated: Bool) { | |
super.viewWillDisappear(animated) | |
UIApplication.shared.statusBarStyle = .lightContent |
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
// 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) | |
} | |
} |