Skip to content

Instantly share code, notes, and snippets.

/// Adds a helper function to mutate a properties and help implement _Builder_ pattern
protocol Buildable { }
extension Buildable {
/// Mutates a property of the instance
///
/// - Parameter keyPath: `WritableKeyPath` to the instance property to be modified
/// - Parameter value: value to overwrite the instance property
private var prepareForReuseBag: Int8 = 0
@objc public protocol Reusable : class {
func prepareForReuse()
}
extension UITableViewCell: Reusable {}
extension UITableViewHeaderFooterView: Reusable {}
extension UICollectionReusableView: Reusable {}
@0111b
0111b / UIView+awakeAfter.swift
Created December 4, 2017 04:18
UIView awake after
import UIKit
extension UIView {
open override func awakeAfter(using aDecoder: NSCoder) -> Any? {
let viewType = type(of: self)
let nibName = String(describing: Mirror(reflecting: self).subjectType)
let bundle = Bundle.main //Bundle(for: viewType)
//Prevents infinite loop from loadNibNamed internally-calling awakeAfterUsingCoder. Is false when called from storyboard, true when
@0111b
0111b / Version.sh
Last active December 4, 2017 04:20
#!/bin/sh
echo "Get version ..."
MAJOR_VERSION="0.1"
if [ -z "${PROJECT_DIR}" ]; then
PROJECT_DIR=`pwd`
fi