Swift-静态让和“ <

问题描述 投票:-31回答:1

我有以下代码

struct Physics {
    static let smallCoin : UInt32 = 0x1 << 1
    static let smallCoin2 : UInt32 = 0x1 << 2
    static let ground : UInt32 = 0x1 << 3
}

我想知道]的含义>

  • static let
  • UInt32 = 0x1 << 3

我有以下代码结构物理{static let smallCoin:UInt32 = 0x1 << 1 static let smallCoin2:UInt32 = 0x1 << 2 static let ground:UInt32 = 0x1 << 3} I ...

ios swift struct sprite-kit swift2
1个回答
6
投票
<<是左移位运算符。您可以更好地以二进制形式可视化它:
© www.soinside.com 2019 - 2024. All rights reserved.