Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
iOS Technical Manager @globant

Alex Rupérez alexruperez

:octocat:
iOS Technical Manager @globant
View GitHub Profile
@alexruperez
alexruperez / Podfile
Created Jan 30, 2019
MaterialTextInputOutlined iOS PoC
View Podfile
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 13, 2019
Take advantage of Siri Shortcuts, suggestions and smart reminders by setting a NSUserActivity to your UIViewController or any other UIResponder subclass.
View UIResponder+UserActivity.swift
//
// UIResponder+UserActivity.swift
//
import UIKit
import CoreSpotlight
import MapKit
public extension UIResponder {
@alexruperez
alexruperez / StoryTellerViewController.swift
Last active May 14, 2018
Create a StoryTeller in Swift with Firebase ML Kit Text Recognition OCR | Lil ‘Bits | https://www.youtube.com/watch?v=kpzyFZYI1PQ
View StoryTellerViewController.swift
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),
View BearmojiViewController.swift
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),
View SiriViewController.swift
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 Mar 15, 2018
BranchUniversalObject subclass with BranchActivityItemProviderDelegate custom or default implementation.
View BranchActivityObject.swift
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 Apr 23, 2018
Silent Remote Notifications
View AppDelegate.swift
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 Aug 22, 2016
Custom CocoaLumberjack logger which sends logs to Crashlytics.
View DDCLSLogger.h
@import CocoaLumberjack;
@interface DDCLSLogger : DDAbstractLogger
@end
@alexruperez
alexruperez / ARSafariViewController.h
Last active Apr 4, 2016
Fix SFSafariViewController StatusBar Style, StatusBar Hidden and freezing when swiping back on iOS 9.2
View ARSafariViewController.h
//
// ARSafariViewController.h
//
// Copyright © 2016 alexruperez. The MIT License (MIT)
//
@import SafariServices;
@interface ARSafariViewController : SFSafariViewController
@alexruperez
alexruperez / ARURLOperation.h
Last active Aug 29, 2015
ARURLOperation -> NSOperation subclass. NSURLRequest. NSURLConnection. NSURLResponse. Response NSData. NSError. KVO. NSThread. NSRunLoop.
View ARURLOperation.h
//
// ARURLOperation.h
// ARURLOperation
//
// Created by alexruperez on 13/1/15.
//
//
#import <Foundation/Foundation.h>
You can’t perform that action at this time.