nil

Discussion in 'iOS Programming' started by grandM, Sep 18, 2015.

  1. grandM macrumors 6502a

    grandM

    Joined:
    Oct 14, 2013
    #1
    If I remember correctly nil in Objective-C meant the pointer was not set to any place in memory yet. Once you initialized the object you could set the pointer to the particular instance being the object.

    But what is nil in Swift? Is it also a pointer not set?
     
  2. smirk macrumors 6502a

    smirk

    Joined:
    Jul 18, 2002
    Location:
    Orange County, CA
    #2
  3. grandM thread starter macrumors 6502a

    grandM

    Joined:
    Oct 14, 2013
    #3
    Yes I know nil is used with Optionals. I also saw in the Stanford course that an optional actually is an enum. But I was wondering how nil got defined in Swift.
     
  4. smirk macrumors 6502a

    smirk

    Joined:
    Jul 18, 2002
    Location:
    Orange County, CA
    #4
    I'd be interested in learning that as well, but I don't know that you'll get the answer you're looking for, beyond what's written in the Swift guide:

     

Share This Page