Skip to content

Instantly share code, notes, and snippets.

View HawkingOuYang's full-sized avatar
👨‍💻
busy doing: WeApp Web iOS Android

HawkingOuYang HawkingOuYang

👨‍💻
busy doing: WeApp Web iOS Android
View GitHub Profile
@HawkingOuYang
HawkingOuYang / 1. __block in MRC and ARC
Last active September 9, 2015 08:59
__block in MRC and ARC [according to Apple Documents]
__block in MRC and ARC [according to Apple Documents]
Ref.: https://developer.apple.com/library/ios/releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html
{
Use Lifetime Qualifiers to Avoid Strong Reference Cycles
You can use lifetime qualifiers to avoid strong reference cycles. For example, typically if you have a graph of objects arranged in a parent-child hierarchy and parents need to refer to their children and vice versa, then you make the parent-to-child relationship strong and the child-to-parent relationship weak. Other situations may be more subtle, particularly when they involve block objects.
@HawkingOuYang
HawkingOuYang / 2. objects passed by reference OR by value
Last active September 9, 2015 09:00
objects passed by reference OR by value [according to Apple Documents]
objects passed by reference OR by value [according to Apple Documents]
Ref.: https://developer.apple.com/library/ios/releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html
//------------------------------------------------------------------------------------------------------------------------//
Take care when using __weak variables on the stack. Consider the following example:
NSString * __weak string = [[NSString alloc] initWithFormat:@"First Name: %@", [self firstName]];
@HawkingOuYang
HawkingOuYang / 3. NSOperation And concurrency
Created September 9, 2015 09:01
NSOperation And concurrency
NSOperation And concurrency
concurrent And non-concurrent 并发与非并发
NSOperationQueue and concurrent vs non-concurrent
http://stackoverflow.com/questions/1646795/nsoperationqueue-and-concurrent-vs-non-concurrent
NSOperation
http://nshipster.com/nsoperation/
@HawkingOuYang
HawkingOuYang / 4. Managing Toll-Free Bridging
Created September 9, 2015 09:40
Managing Toll-Free Bridging
Managing Toll-Free Bridging
Ref.: https://developer.apple.com/library/ios/releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html
In many Cocoa applications, you need to use Core Foundation-style objects, whether from the Core Foundation framework itself (such as CFArrayRef or CFMutableDictionaryRef) or from frameworks that adopt Core Foundation conventions such as Core Graphics (you might use types like CGColorSpaceRef and CGGradientRef).
The compiler does not automatically manage the lifetimes of Core Foundation objects; you must call CFRetain and CFRelease (or the corresponding type-specific variants) as dictated by the Core Foundation memory management rules (see Memory Management Programming Guide for Core Foundation).
@HawkingOuYang
HawkingOuYang / 5. How to use .gitignore for Xcode
Last active September 6, 2021 06:17
.gitignore 语法 与 Xcode
################################################
# Added by OYXJ on 2016-01-01
#
# Configure git to track only one file extension
# http://stackoverflow.com/questions/12799855/configure-git-to-track-only-one-file-extension
#
# Using .gitignore to ignore everything but specific directories
# http://stackoverflow.com/questions/5241644/using-gitignore-to-ignore-everything-but-specific-directories
#
# Git ignore file for Xcode projects (重要)