Skip to content

Instantly share code, notes, and snippets.

🇫🇷
Travel lover

Aurélien grifas

🇫🇷
Travel lover
Block or report user

Report or block grifas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@grifas
grifas / TopIconButton.swift
Created Oct 1, 2018
A button with an icon on top
View TopIconButton.swift
import Foundation
class TopIconButton: UIButton {
var color: UIColor = Color.Green
private init(with color: UIColor) {
self.color = color
super.init(frame: .zero)
@grifas
grifas / SelfSizingAccessoryViewCell.swift
Last active Sep 17, 2018
UITableViewCell with a self sizing accessory view
View SelfSizingAccessoryViewCell.swift
class MyCell: UITableViewCell {
init() {
// Initialize...
accessoryView = UIView()
accessoryView?.translatesAutoresizingMaskIntoConstraints = false
addSubview(accessoryView!)
@grifas
grifas / ScrollViewSwipeGestureRequireToFail.swift
Last active Aug 3, 2018
SwipeGesture in scrollView: require to fail.
View ScrollViewSwipeGestureRequireToFail.swift
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
@grifas
grifas / setLeftTitleView.swift
Last active Mar 2, 2018
iOS - Set a left title view in navigation bar
View setLeftTitleView.swift
override func viewDidLoad() {
super.viewDidLoad()
// This keep the back button after setting the left title view
navigationItem.leftItemsSupplementBackButton = true
}
func setLeftTitleView() {
let titleLabel = UILabel()
@grifas
grifas / AddJsonFileToTestBundle.txt
Created Dec 18, 2017
Add json file to test bundle
View AddJsonFileToTestBundle.txt
Build Phases -> Add Build Phase -> Copy Bundle Resources
Add json file there
@grifas
grifas / socialNetworksDeepLinks.swift
Created Nov 30, 2017
Social Networks Deep Links
View socialNetworksDeepLinks.swift
@grifas
grifas / controller.swift
Last active Jan 11, 2018
Pushed View Controller with a transparent navigation bar
View controller.swift
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
initNavigationBar()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
UIApplication.shared.statusBarStyle = .lightContent
@grifas
grifas / HMAC-SHA1-BASE64-SIGNATURE.swift
Last active Jan 11, 2018
String Extension to get based 64 signature to sign google api urls in swift 3
View HMAC-SHA1-BASE64-SIGNATURE.swift
// 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)
}
}
You can’t perform that action at this time.