• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using new stuff
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using new stuff


  • Subject: Re: Using new stuff
  • From: Chris Hanson <email@hidden>
  • Date: Fri, 18 Nov 2016 22:34:56 -0800

On Nov 17, 2016, at 7:47 PM, Gerriet M. Denkmann <email@hidden> wrote:

One question: this option seems to be around for almost 2 years - why is it not widely known?
And why is it not set as default in Xcode?

One shouldn’t necessarily want a warning for any use of an API newer than your deployment target. That would discourage people from using the API, instead of just checking whether the system supports the API.

For example, you probably don’t want to get a warning from code like this:

    if (systemVersion >= systemVersionSierra) {
        DoSomethingNewInSierra(); // API that has Sierra+ availability
    } else {
        DoSomethingElse();        // something that works on an older OS
    }

You would only want a warning if you weren’t checking the system version before calling the API. However, determining whether that check has indeed occurred is actually quite difficult.

Swift has a specific “if #available(macOS 10.12, *)” syntax for just this purpose, see <https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/ControlFlow.html#//apple_ref/doc/uid/TP40014097-CH9-ID523> for details. Thus when writing Swift, you’re warned by default when you use an API newer than your deployment target without such a check, and the warning doesn’t imply “don’t use the API,” it implies “put in a check.”

  -- Chris

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Using new stuff
      • From: Jens Alfke <email@hidden>
References: 
 >Using new stuff (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Using new stuff (From: Aaron Tuller <email@hidden>)
 >Re: Using new stuff (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: Is there some Xcode conflict against shortcuts assigned from the Keyboard System Preference?
  • Next by Date: Re: FBSOpenApplicationServiceErrorDomain errors
  • Previous by thread: Re: Using new stuff
  • Next by thread: Re: Using new stuff
  • Index(es):
    • Date
    • Thread