Skip to content

Instantly share code, notes, and snippets.

View mourad-brahim's full-sized avatar

Mourad Brahim mourad-brahim

  • Sousse, Tunisia
View GitHub Profile
@mourad-brahim
mourad-brahim / UITapGestureRecognizerExtensions.swift
Created December 28, 2018 15:50
Handle tap action on a specifc text range
import UIKit
extension UITapGestureRecognizer {
/// Use this function to handle tap action on a label's text
///
/// - parameter label: The label instance on which the tap action needs to be handled
/// - parameter targetRange: The range of text you want to handle the tap on it
///
/// - returns: A boolean indicating if the specified text range was tapped
@mourad-brahim
mourad-brahim / Match_Guide.md
Last active January 2, 2019 13:11
Add existing certificates and profiles to be used with match

Certificates:

1- Find the team identifier somewhere in Xcode or the Apple developer portal

2- Export the existing certificate from your keychain. Two files are needed; certificate.p12 and certificate.cer

3- The files exported on the 2nd step needs to be encrypted use the following commands to do that: openssl pkcs12 -nocerts -nodes -out key.pem -in certificate.p12 openssl aes-256-cbc -k your_password -in key.pem -out cert_id.p12 -a

@mourad-brahim
mourad-brahim / UIView+Animations.swift
Last active December 1, 2022 07:29
Shake animation with swift
extension UIView {
func shake(duration: CFTimeInterval) {
let translation = CAKeyframeAnimation(keyPath: "transform.translation.x");
translation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear)
translation.values = [-5, 5, -5, 5, -3, 3, -2, 2, 0]
let rotation = CAKeyframeAnimation(keyPath: "transform.rotation.z")
rotation.values = [-5, 5, -5, 5, -3, 3, -2, 2, 0].map {
(let degrees: Double) -> Double in
let radians: Double = (M_PI * degrees) / 180.0