Skip to content

Instantly share code, notes, and snippets.

@soyoes
Last active October 17, 2018 16:46
Show Gist options
  • Save soyoes/5df2906e7980d87bc7a6 to your computer and use it in GitHub Desktop.
Save soyoes/5df2906e7980d87bc7a6 to your computer and use it in GitHub Desktop.
OBJC Tips
* strong, weak, assign
http://stackoverflow.com/questions/8927727/objective-c-arc-strong-vs-retain-and-weak-vs-assign
* bridge (void* => id, id => void*)
http://stackoverflow.com/questions/18976016/how-to-specify-property-to-c-pointer-in-arc-environment
* arr.indexOf
```Objective-C
//BAD: it returns max int.
(int)[arr indexOfObject:obj]>0
//Good
[arr indexOfObject:obj]==NSNotFound
//Better
[arr containsObject:obj]
```
* str format
use "%llu", for long long
* use long long instead of long
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment