Skip to content

Instantly share code, notes, and snippets.

@yycking
yycking / plcrashReporter_setCrashCallbacks.swift
Created December 12, 2016 10:16
crashReporter.setCrashCallbacks on swift
func crashReporterScreenCapture(info:UnsafeMutablePointer<siginfo_t>, uap:UnsafeMutablePointer<ucontext_t>, context:UnsafeMutablePointer<Void>) {
}
var crashReporterCapture = PLCrashReporterCallbacks()
crashReporterCapture.version = 0
crashReporterCapture.context = nil
crashReporterCapture.handleSignal = crashReporterScreenCapture
crashReporter.setCrashCallbacks(&crashReporterCapture)
@yycking
yycking / NSLocalizedString+Base.m
Last active December 1, 2016 09:06
NSLocalizedString auto load Base.lproj if key not found
#ifndef L
#define L(key) [NSBundle.mainBundle localizedStringForKey:(key)]
#endif
@interface NSBundle (NSLocalizedString_Base)
- (NSString *)localizedStringForKey:(NSString *)key;
@end
@implementation NSBundle (NSLocalizedString_Base)
@yycking
yycking / NS_ENUM_STRING.m
Created December 1, 2016 08:35
NS_ENUM 支援字串
#define LIST_OF_ServerAPI \
/*會員*/ \
api(登入, member/login) \
api(FB登入, member/fbLogin)
typedef NS_ENUM(NSInteger, ServerAPI) {
#define api(key, name) key,
LIST_OF_ServerAPI
#undef api
};