Skip to content

Instantly share code, notes, and snippets.

@mattt
Created November 11, 2013 15:12
Show Gist options
  • Save mattt/7414618 to your computer and use it in GitHub Desktop.
Save mattt/7414618 to your computer and use it in GitHub Desktop.

Greetings, NSHipsters!

As we prepare to increment our NSDateComponents -year by 1, it's time once again for NSHipster end-of-the-year Reader Submissions! Last year, we got some mind-blowing tips and tricks. With the release of iOS 7 & Mavericks, and a year's worth of new developments in the Objective-C ecosystem, there should be a ton of new stuff to write up for this year.

Submit your favorite piece of Objective-C trivia, framework arcana, hidden Xcode feature, or anything else you think is cool, and you could have it featured in the year-end blowout article. Just comment on this gist below!

Here are a few examples of the kind of things I'd like to see:

Can't wait to see what y'all come up with!

@acoomans
Copy link

iOS7 has introduced a lot of changes in the API, both deprecating and introducing new methods, in different frameworks.

One way to deal with this is to temporary disable the deprecated warnings in clang with a pragma (where you handle the API differences).

Another way is to use the excellent Deploymate for managing different iOS versions. It analyzes your code and gives you warnings for deprecated/new methods. Like with clang, you can use a pragma to let Deploymate ignore it.

Here is a gist with a few macros to help with checking the iOS version and ignore both clang and Deploymate's warnings.

To use the macros, simply do:

AVAILABLE_API_IF_GREATER_THAN(@“7.0”)
    do_something_only_in_ios7();
AVAILABLE_API_ELSE
    do_something_for_others();
AVAILABLE_API_END

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment