Learning Center

Learning Center

Learn Menu

Anchor

This article merely explains the anchor syntax in Genesis. For more information about the feature itself, please read the anchor article in the engine menu.

Syntax

The anchor syntax is pretty straightforward - you just put the anchor keyword in front of a class/enum/class property/enum case declaration.

Let's take a look at some examples.

Anchored class

  anchor class User {
    var username: string
}

Anchored enum case

  enum Color: int {
    case Blue
    case Red
    case Yellow
    anchor case Unknown
}

We use cookies to track activity using Google Analytics & reCAPTCHA. It helps us understand what our visitors like about our product and how they interact with our website. For more information, check out our Privacy Policy.