Skip to content

Instantly share code, notes, and snippets.

View shaps80's full-sized avatar
🏠
Working from home

Shaps shaps80

🏠
Working from home
View GitHub Profile
@shaps80
shaps80 / UIView+NibLoading.swift
Created January 5, 2016 13:40 — forked from samdods/UIView+NibLoading.swift
This is the best way I've found to load a view from a nib in swift.
//
// UIView+NibLoading.swift
// Sam Dods on 29/10/2015.
//
import UIKit
/// Protocol to be extended with implementations
protocol UIViewLoading {}
typedef NS_ENUM(NSInteger, kErrorCode) {
kErrorCodeInternal = 431432,
};
extern NSError *NSErrorMake(NSString *message, NSInteger code, NSDictionary *aUserInfo, NSString *methodOrFunction);
#define NSObjcAssert NSAssert
#define InvalidConditionString(condition) (@"Invalid condition not satisfying: " #condition)
#define GenericAssertCondition(ctype, condition) NS ## ctype ## Assert((condition), InvalidConditionString((condition)))
#define GenericErrorMake(condition, func) NSErrorMake(InvalidConditionString((condition)), kErrorCodeInternal, nil, func)