Skip to content

Instantly share code, notes, and snippets.

View fmo91's full-sized avatar

Fernando Martín Ortiz fmo91

View GitHub Profile
//
// FOAttributedStringBuilder.swift
//
// Created by Fernando Ortiz on 18/11/15.
// Copyright © 2015 Fernando Ortiz. All rights reserved.
//
import Foundation
class FOAttributedStringBuilder {
@fmo91
fmo91 / Dequeuable.swift
Last active October 4, 2016 03:49
Dequeuable.swift is a protocol extension that I heavily use in my projects to avoid using string literals while dequeuing cells from table views.
//
// Dequeuable.swift
//
// Created by Fernando Ortiz on 9/30/16.
// Copyright © 2016 Fernando Martín Ortiz. All rights reserved.
//
import UIKit
/**
@fmo91
fmo91 / Registrable.swift
Created October 4, 2016 03:57
Simple protocol extension for easily registering UITableViewCell without hardcoding strings.
//
// Registrable.swift
//
// Created by Fernando Ortiz on 9/30/16.
// Copyright © 2016 Fernando Martín Ortiz. All rights reserved.
//
import UIKit
/**
@fmo91
fmo91 / UIFont+Custom.swift
Created October 4, 2016 04:01
Handy extension to use custom fonts in your iOS Swift application without hardcoding strings.
//
// UIFont+Custom.swift
//
// Created by Fernando Ortiz on 10/1/16.
// Copyright © 2016 Fernando Martín Ortiz. All rights reserved.
//
import UIKit
enum CustomFont: String {
@fmo91
fmo91 / LoadingButton.swift
Created October 4, 2016 17:08
Simple UIButton subclass that can show a customizable loading message
//
// LoadingButton.swift
// LoadingButton
//
// Created by Fernando Ortiz on 4/10/16.
// Copyright © 2016 Fernando Martín Ortiz. All rights reserved.
//
import UIKit
@fmo91
fmo91 / DogsTableViewDriver.swift
Created January 4, 2017 01:02
A sample UITableView delegate and data source implemented as a separated object
//
// DogsTableViewDriver.swift
// MediumSamples
//
// Created by Fernando Ortiz on 1/3/17.
// Copyright © 2017 Fernando Martín Ortiz. All rights reserved.
//
import UIKit
@fmo91
fmo91 / DogsViewController.swift
Last active January 4, 2017 01:20
Sample view controller that does not worry about the table view presentation details.
//
// DogsViewController.swift
// MediumSamples
//
// Created by Fernando Ortiz on 1/3/17.
// Copyright © 2017 Fernando Martín Ortiz. All rights reserved.
//
import UIKit
@fmo91
fmo91 / SampleViewController.swift
Created January 4, 2017 04:29
Sample view controller that is instantiated using xibs.
//
// SampleViewController.swift
// MediumSamples
//
// Created by Fernando Ortiz on 1/4/17.
// Copyright © 2017 Fernando Martín Ortiz. All rights reserved.
//
import UIKit
@fmo91
fmo91 / AppDelegate.swift
Created January 4, 2017 04:34
Sample AppDelegate that starts the application without using storyboards
//
// AppDelegate.swift
// MediumSamples
//
// Created by Fernando Ortiz on 1/3/17.
// Copyright © 2017 Fernando Martín Ortiz. All rights reserved.
//
import UIKit
// In the async side...
func someAsyncFunction(completion: @escaping (Error?) -> Void) {
// Something that takes some time to complete.
completion(nil) // Or completion(SomeError.veryBadError)
}
// In the consumer side...
someAsyncFunction { error in
if let error = error {
print("Oops! Something went wrong...")