Yaohong

为了真相不惜被羞辱

Must-know information about Swift

Key Swift concepts you should be aware of

Must-know information about Swift

entry point

main?

print("Hello swift")
let name = "swift"
print("Hello, \(name)")
print("Hello, \(name1 ?? name)")// If the optional value is missing, the default value is used instead.

Variable, Constant

Int:

  • On a 32-bit platform, Int is the same size as Int32.
  • On a 64-bit platform, Int is the same size as Int64.

UInt:

  • On a 32-bit platform, UInt is the same size as UInt32.
  • On a 64-bit platform, UInt is the same size as UInt64.

Double represents a 64-bit floating-point number.