Skip to content

Instantly share code, notes, and snippets.

@nahuelDeveloper
nahuelDeveloper / TwitterShare.swift
Last active May 2, 2018 10:41
Share a gif on Twitter. Code adapted for Swift 3 and iOS 10
// MARK: - Twitter
/*
To upload a gif to Twitter, two different API calls are needed.
One to upload the gif. The other, to append a comment to the gif.
https://xcodenoobies.blogspot.com.ar/2016/01/how-to-using-slrequest-to-upload-image.html?showComment=1460489097793#c638358337669317406
*/
static func twitterShare(from viewController: FinishVideoViewController, path: String) {
let account = ACAccountStore()
@nahuelDeveloper
nahuelDeveloper / CalculatorView.swift
Created October 4, 2017 12:49 — forked from natecook1000/CalculatorView.swift
An IBInspectable Calculator Construction Set
// CalculatorView.swift
// as seen in http://nshipster.com/ibinspectable-ibdesignable/
//
// (c) 2015 Nate Cook, licensed under the MIT license
import UIKit
/// The alignment for drawing an String inside a bounding rectangle.
enum NCStringAlignment {
case LeftTop
@nahuelDeveloper
nahuelDeveloper / .swift
Created October 31, 2017 21:18
AppDelegate example with logic to handle Remote Push Notifications from Firebase
import UIKit
import UserNotifications
import Firebase
import FirebaseInstanceID
import FirebaseMessaging
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate, MessagingDelegate {
var window: UIWindow?
@nahuelDeveloper
nahuelDeveloper / regex.playground
Created April 4, 2022 21:24
Simple Regex Checker in Swift
class RegexManager {
var regex: NSRegularExpression
init?(regexPattern: String) {
do {
regex = try NSRegularExpression(pattern: regexPattern)
} catch {
// Invalid pattern
return nil
@nahuelDeveloper
nahuelDeveloper / Extension+TableView.swift
Created April 14, 2022 17:19
Extension for easier registering and dequeueing of TableView cells
protocol ReusableView: AnyObject {
static var defaultReuseIdentifier: String { get }
}
extension ReusableView where Self: UIView {
static var defaultReuseIdentifier: String {
return String(describing: self)
}
}