Skip to content

Instantly share code, notes, and snippets.

@MathieuWhite
MathieuWhite / Obfuscator.swift
Created July 3, 2016 13:33
Obfuscator for Swift
//
// Obfuscator.swift
// SwiftObfuscatorExample
//
// Created by Mathieu White on 2016-07-03.
// Copyright © 2016 Mathieu White. All rights reserved.
//
import Foundation
@MathieuWhite
MathieuWhite / NewSelectors.swift
Last active July 11, 2016 18:51
A new way to do selectors in Swift 2.2.
private extension Selector {
static let buttonPressed = #selector(ViewController.buttonPressed(_:))
}
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let button: UIButton = UIButton(type: UIButtonType.Custom)
button.addTarget(self,
@MathieuWhite
MathieuWhite / FacebookManager.swift
Created April 2, 2016 12:46
Facebook user management for login and logout in Swift.
//
// FacebookManager.swift
//
// Created by Mathieu White on 2016-02-07.
// Copyright © 2016 Mathieu White. All rights reserved.
//
import UIKit
import FBSDKCoreKit
import FBSDKLoginKit
@MathieuWhite
MathieuWhite / UIImageExtension.swift
Created April 2, 2016 12:45
UIImage Extension that creates an image with text
//
// UIImageExtension.swift
//
// Created by Mathieu White on 2016-02-05.
// Copyright © 2016 Mathieu White. All rights reserved.
//
import UIKit
extension UIImage
@MathieuWhite
MathieuWhite / OptionalDelegate.swift
Created February 8, 2016 15:12
100% Optional Delegate Functions in Swift
protocol SomeDelegate: class
{
func function()
func optionalFunction()
}
extension SomeDelegate
{
func optionalFunction() { print("This will get called if the function isn't implemented") }
}