Skip to content

Instantly share code, notes, and snippets.

@Hugo6991
Created February 21, 2022 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hugo6991/d208f5e5e20a8d5373fd6e84df0abd34 to your computer and use it in GitHub Desktop.
Save Hugo6991/d208f5e5e20a8d5373fd6e84df0abd34 to your computer and use it in GitHub Desktop.
05 | Set
// Set 就是一個系列,裡面可以包含很多個精彩好球 play
pub struct SetData {
// 每個 Set 有一個獨特的 ID 表示
pub let setID: UInt32
// Set 名字,例如 "Cool Cats" 系列
pub let name: String
// Set 所屬的世代,像現在已經到了世代 3,
// 也可以理解是季的意思,
// 畢竟目前 series 3 就是 NBA Top Shop 推出後的第三季 NBA
pub let series: UInt32
// 創建 struct 時候的初始化 function
// 主要就是初始化上述提到的那些 variables
init(name: String) {
pre {
name.length > 0: "New Set name cannot be empty"
}
self.setID = TopShot.nextSetID
self.name = name
self.series = TopShot.currentSeries
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment