Skip to content

Instantly share code, notes, and snippets.

View hanfengs's full-sized avatar

hanfengs

  • Beijing China
View GitHub Profile
@kangzubin
kangzubin / UIDevice+XMUtils.h
Last active September 2, 2022 09:46
The sample code to get iPhone device name.
//
// UIDevice+XMUtils.h
// AwesomeTips
//
// Created by kangzubin on 2018/9/20.
// Copyright © 2018 KANGZUBIN. All rights reserved.
//
#import <UIKit/UIKit.h>
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
extension Notification {
struct UserInfoKey<ValueType>: Hashable {
let key: String
}
@dreampiggy
dreampiggy / CategoryMacro.h
Created April 13, 2017 07:19
Objective-C Category Property Macro
#ifndef TTD_CATEGORY_PROPERTY
#define TTD_CATEGORY_PROPERTY
#import <objc/runtime.h>
#define TTD_GET_PROPERTY(property) objc_getAssociatedObject(self, @selector(property));
#define TTD_SET_STRONG(property) objc_setAssociatedObject(self, @selector(property), property, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
#define TTD_SET_COPY(property) objc_setAssociatedObject(self, @selector(property), property, OBJC_ASSOCIATION_COPY_NONATOMIC);
#define TTD_SET_UNSAFE_UNRETAINED(property) objc_setAssociatedObject(self, @selector(property), property, OBJC_ASSOCIATION_ASSIGN);
#define TTD_SET_ASSIGN(property, value) objc_setAssociatedObject(self, @selector(property), value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
#define TTD_SET_WEAK(property) id __weak __weak_object = property; \
id (^__weak_block)() = ^{ return __weak_object; }; \