skip to Main Content

What type of variable is e.g. .bottom? I want to declare such a variable or want to send passing data with this variable.

2

Answers


  1. It’s value of enum.

    enum CompassPoint {
        case north
        case south
        case east
        case west
    }
    

    When you have that enum like in example above then you can use that:

    let compassPoint = CompassPoint.west
    let compassPoint: CompassPoint = .west
    

    When the type is known then you can use the syntax with ..

    Login or Signup to reply.
  2. It could be any type with a member called bottom. It has been omitted because the compiler can parse "implicit member expressions". It means that whenever the compiler can infer the type from the context, you do not need to write it. Back to your problem: you could do a "Command"-Click on the expression and let XCode tell you more about the context.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search