Skip to content

Instantly share code, notes, and snippets.

View alexruperez's full-sized avatar
:octocat:
Tech Director @globant

Alex Rupérez alexruperez

:octocat:
Tech Director @globant
View GitHub Profile
@alexruperez
alexruperez / Podfile
Created January 30, 2019 11:36
MaterialTextInputOutlined iOS PoC
platform :ios, '10.3'
target 'MaterialTextInputOutlinedPoC' do
use_frameworks!
pod 'MaterialComponents/TextFields+ColorThemer', '~> 75.0'
pod 'MaterialComponents/TextFields+TypographyThemer', '~> 75.0'
end
@alexruperez
alexruperez / UIResponder+UserActivity.swift
Last active May 6, 2021 00:47
Take advantage of Siri Shortcuts, suggestions and smart reminders by setting a NSUserActivity to your UIViewController or any other UIResponder subclass.
//
// UIResponder+UserActivity.swift
//
import UIKit
import CoreSpotlight
import MapKit
public extension UIResponder {
@alexruperez
alexruperez / StoryTellerViewController.swift
Last active May 14, 2018 09:02
Create a StoryTeller in Swift with Firebase ML Kit Text Recognition OCR | Lil ‘Bits | https://www.youtube.com/watch?v=kpzyFZYI1PQ
import UIKit
import AVFoundation
import Firebase
class StoryTellerViewController: UIViewController {
private lazy var previewLayer = AVCaptureVideoPreviewLayer(session: captureSession)
private lazy var captureSession: AVCaptureSession = {
let captureSession = AVCaptureSession()
guard let captureDevice = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back),
@alexruperez
alexruperez / BearmojiViewController.swift
Last active April 23, 2018 11:41
Create your own Animoji in Swift | Lil ‘Bits | https://www.youtube.com/watch?v=6Khyi2xKow4
import UIKit
import Vision
import AVFoundation
class BearmojiViewController: UIViewController {
private lazy var drawLayer = CALayer()
private lazy var captureSession: AVCaptureSession = {
let captureSession = AVCaptureSession()
guard let captureDevice = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .front),
@alexruperez
alexruperez / SiriViewController.swift
Last active November 29, 2018 16:32
Create your own Siri in Swift | Lil ‘Bits | https://www.youtube.com/watch?v=Sigl3dihEB8
import UIKit
import Speech
class SiriViewController: UIViewController {
private static let locale = Locale(identifier: "es-ES")
private let speechRecognizer = SFSpeechRecognizer(locale: SiriViewController.locale)!
private var recognitionRequest: SFSpeechAudioBufferRecognitionRequest?
private var recognitionTask: SFSpeechRecognitionTask?
private let audioEngine = AVAudioEngine()
@alexruperez
alexruperez / BranchActivityObject.swift
Created March 15, 2018 13:28
BranchUniversalObject subclass with BranchActivityItemProviderDelegate custom or default implementation.
import Branch
public protocol BranchActivityObjectDelegate: BranchActivityItemProviderDelegate {}
public class BranchActivityObject: BranchUniversalObject {
private weak var delegate: BranchActivityObjectDelegate?
private var params: [AnyHashable : Any]!
private var linkProperties: BranchLinkProperties!
@alexruperez
alexruperez / AppDelegate.swift
Last active April 23, 2018 11:43
Silent Remote Notifications
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
if !application.isRegisteredForRemoteNotifications {
application.registerForRemoteNotifications()
}
return true
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
print(deviceToken.reduce("", {$0 + String(format: "%02X", $1)}))
}
@alexruperez
alexruperez / DDCLSLogger.h
Created August 22, 2016 18:04
Custom CocoaLumberjack logger which sends logs to Crashlytics.
@import CocoaLumberjack;
@interface DDCLSLogger : DDAbstractLogger
@end
@alexruperez
alexruperez / ARSafariViewController.h
Last active April 4, 2016 10:37
Fix SFSafariViewController StatusBar Style, StatusBar Hidden and freezing when swiping back on iOS 9.2
//
// ARSafariViewController.h
//
// Copyright © 2016 alexruperez. The MIT License (MIT)
//
@import SafariServices;
@interface ARSafariViewController : SFSafariViewController
@alexruperez
alexruperez / ARURLOperation.h
Last active August 29, 2015 14:13
ARURLOperation -> NSOperation subclass. NSURLRequest. NSURLConnection. NSURLResponse. Response NSData. NSError. KVO. NSThread. NSRunLoop.
//
// ARURLOperation.h
// ARURLOperation
//
// Created by alexruperez on 13/1/15.
//
//
#import <Foundation/Foundation.h>