Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Shaps shaps80

🏠
Working from home
View GitHub Profile
@shaps80
shaps80 / UIView+NibLoading.swift
Created Jan 5, 2016 — forked from samdods/UIView+NibLoading.swift
This is the best way I've found to load a view from a nib in swift.
View UIView+NibLoading.swift
//
// UIView+NibLoading.swift
// Sam Dods on 29/10/2015.
//
import UIKit
/// Protocol to be extended with implementations
protocol UIViewLoading {}
View gist:9590376
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)