This is my code snippets for cocoa