Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Intermediate Swift 2 Properties Type Properties

Help...Intermediate Swift Couse Code Challenge 1

I have No idea what to do, but his demonstration didn't really show/tell me how to use this with 1 struct, watched it again a few times, but still don't get it

Another shot at it

struct LevelTracker {
    let maxLevel: LevelTracker
}
game.swift
struct LevelTracker {
    let maxLevel: Int
}

LevelTracker.init(maxLevel: 4)

1 Answer

A type property in Swift uses the keyword static:

struct LevelTracker {
  static let maxLevel = 232
}

Oh, i kept making it a custom type. Thanks for the help

Oh, i kept making it a custom type. Thanks for the help