Skip to content

Instantly share code, notes, and snippets.

Dawn Song acalism

  • 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
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
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/
2. copy stdc++*.dylib to
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/
View macros_from_iOS.md
// same with each other
NS_AVAILABLE_IOS(10.0)
__IOS_AVAILABLE(10.0)
@acalism
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
acalism / objc-lightweight-generics.m
Created Jun 15, 2018
Implementation and Inheritance of objc lightweight generics
View objc-lightweight-generics.m
// Header File
NS_ASSUME_NONNULL_BEGIN
// No asterisk after DataType
@interface BaseCell<DataType> : UICollectionViewCell
- (DataType)data;
- (void)bindData:(DataType)data;
@acalism
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.
@end
View UpdateViewConstraints.m
#import <Masonry/Masonry.h>
@implementation ViewController {
UIView * _v;
UILabel * _label;
bool _constraintsAdded;
}
View app-rating.swift
if #available(iOS 10.3, *) {
//SKStoreReviewController.requestReview()
//app.openURL(URL(string: "itms-apps://itunes.apple.com/app/id1018728680?action=write-review")!) // 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.