Skip to content

Instantly share code, notes, and snippets.

@sideshowcoder
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sideshowcoder/cb9049a7d4d56fcfa72f to your computer and use it in GitHub Desktop.
Save sideshowcoder/cb9049a7d4d56fcfa72f to your computer and use it in GitHub Desktop.
def create_item title
list = Item.alloc.initInDatabase(database, withTitle:title)
error_ptr = Pointer.new(:object)
list.save(error_ptr)
if error_ptr[0]
alert = UIAlertView.alloc.initWithTitle("Error", message: "Failed to create new item", delegate: nil, cancelButtonTitle: "Ok", otherButtonTitles: nil)
alert.show
else
list
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment