Skip to content

Instantly share code, notes, and snippets.

Working from home

Dawn Song acalism

Working from home
  • Tencent, Alibaba
  • Shenzhen City, Guangdong Province, China
Block or report user

Report or block acalism

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
acalism / AppleDevices.m
Last active Nov 8, 2019
How to get Device Model and Model Name(Human readable)
View AppleDevices.m
// see my comments
View make Xcode 10 use stdc++
copy these files from Xcode 9 to Xcode 10 like this:
1. copy stdc++*.tbd to
2. copy stdc++*.dylib to
// same with each other
acalism / confusing-naming-error.m
Last active Aug 12, 2018
ld error. It's really difficult to locate the problem.
View confusing-naming-error.m
// in header file
extern struct LALIMtopAPI {
__unsafe_unretained NSString *logout;
__unsafe_unretained NSString *login;
} const kLALIMtopAPI;
// implementation file
View When do you want to use Swift
1. 想缩短类名或方法名时
2. 希望使用嵌套类
1. 希望使用语法检查更严的泛型时
2. 想使用 String 枚举作为常量时
1. 不希望在头文件和代码文件反复切换时
acalism / objc-lightweight-generics.m
Created Jun 15, 2018
Implementation and Inheritance of objc lightweight generics
View objc-lightweight-generics.m
// Header File
// No asterisk after DataType
@interface BaseCell<DataType> : UICollectionViewCell
- (DataType)data;
- (void)bindData:(DataType)data;
acalism / objc-variable.m
Created Jun 14, 2018
Difference between ivar and global var
View objc-variable.m
@implementation MyClass {
// It is an ivar, or called member variable
// Can NOT be initialized when defined.
// Can be accessed with `self->_i`
int _i;
int i = 9; // Global variable, and can be initialized when defined.
View UpdateViewConstraints.m
#import <Masonry/Masonry.h>
@implementation ViewController {
UIView * _v;
UILabel * _label;
bool _constraintsAdded;
View app-rating.swift
if #available(iOS 10.3, *) {
//app.openURL(URL(string: "itms-apps://")!) // app前的cn段也不是必须啊
} else {
// Fallback on earlier versions
View BKLabel.swift
private let kEllipsesCharacter = "\u{2026}"
/// This componet is designed to resolve those problems:
/// 1. Calculate frame.
/// 2. TouchableLinks.
/// 3. Line/Height limits and followed by "..."/"...全文"/... .
class BKLabel: UIView {
/// 文本内容
var attributedText: NSAttributedString? {
You can’t perform that action at this time.