SteamID

Swift
public struct SteamID

extension SteamID: Hashable, Comparable, CustomStringConvertible, Sendable

The globally unique identifier for all Steam accounts, Steam groups, lobbies, and chat rooms.

Steamworks CSteamID. Methods and interface style to follow Steamworks, see docs there.


Topics

Properties

var universe: Universe

The universe of the SteamID.

Declaration
Swift
public var universe: Universe { get set }

var accountType: AccountType

The account type of the SteamID.

Declaration
Swift
public var accountType: AccountType { get set }

var accountInstance: Int

The account instance of the SteamID. Max 20 bits, 0xfffff.

Declaration
Swift
public var accountInstance: Int { get set }

var accountID: AccountID

The account ID of the SteamID.

Declaration
Swift
public var accountID: AccountID { get set }

var asUInt64: UInt64

Converts steam ID to its 64-bit representation

Declaration
Swift
public var asUInt64: UInt64 { get }

var staticAccountKey: UInt64

Converts the static parts of a steam ID to a 64-bit representation.

For multiseat accounts, all instances of that account will have the same static account key, so they can be grouped together by the static account key.

Declaration
Swift
public var staticAccountKey: UInt64 { get }

Queries

var isValid: Bool

Is the SteamID valid?

Declaration
Swift
public var isValid: Bool { get }

var isBlankAnonAccount: Bool

Is this an anonymous game server login that will be filled in?

Declaration
Swift
public var isBlankAnonAccount: Bool { get }

var isGameServerAccount: Bool

Is this a game server account id? (Either persistent or anonymous)

Declaration
Swift
public var isGameServerAccount: Bool { get }

var isPersistentGameServerAccount: Bool

Is this a persistent (not anonymous) game server account id?

Declaration
Swift
public var isPersistentGameServerAccount: Bool { get }

var isAnonGameServerAccount: Bool

Is this an anonymous game server account id?

Declaration
Swift
public var isAnonGameServerAccount: Bool { get }

var isContentServerAccount: Bool

Is this a content server account id?

Declaration
Swift
public var isContentServerAccount: Bool { get }

var isClanAccount: Bool

Is this a clan account id?

Declaration
Swift
public var isClanAccount: Bool { get }

var isChatAccount: Bool

Is this a chat account id?

Declaration
Swift
public var isChatAccount: Bool { get }

var isLobby: Bool

Is this a chat lobby account id?

Declaration
Swift
public var isLobby: Bool { get }

var isIndividualAccount: Bool

Is this an individual user account id?

Declaration
Swift
public var isIndividualAccount: Bool { get }

var isAnonAccount: Bool

Is this an anonymous account?

Declaration
Swift
public var isAnonAccount: Bool { get }

var isAnonUserAccount: Bool

Is this an anonymous user account? ( used to create an account or reset a password )

Declaration
Swift
public var isAnonUserAccount: Bool { get }

var isConsoleUserAccount: Bool

Is this a faked up Steam ID for a PSN friend account?

Declaration
Swift
public var isConsoleUserAccount: Bool { get }

Initializers

init()

Create a fresh invalid SteamID.

Declaration
Swift
public init()

init(accountID: AccountID, universe: Universe, accountType: AccountType)

Create a Steam ID using the default instance.

Declaration
Swift
public init(accountID: AccountID, universe: Universe, accountType: AccountType)

init(accountID: AccountID, accountInstance: Int, universe: Universe, accountType: AccountType)

Create a Steam ID with an instance.

Declaration
Swift
public init(
    accountID: AccountID, accountInstance: Int, universe: Universe,
    accountType: AccountType)

init(UInt64)

Create a Steam ID from a 64-bit representation

Declaration
Swift
public init(_ steamID: UInt64)

Compound Setters

func set(accountID: AccountID, universe: Universe, accountType: AccountType)

Set parameters for steam ID

Declaration
Swift
public mutating func set(
    accountID: AccountID, universe: Universe, accountType: AccountType)

func instancedSet(accountID: AccountID, accountInstance: Int, universe: Universe, accountType: AccountType)

Set parameters for steam ID

Declaration
Swift
public mutating func instancedSet(
    accountID: AccountID, accountInstance: Int, universe: Universe,
    accountType: AccountType)

func fullSet(identifier: UInt64, universe: Universe, accountType: AccountType)

Initialize a steam ID from its 52 bit parts and universe/type

Declaration
Swift
public mutating func fullSet(
    identifier: UInt64, universe: Universe, accountType: AccountType)

func setFromUInt64(UInt64)

Initialize a steam ID from its 64-bit representation

Declaration
Swift
public mutating func setFromUInt64(_ steamID: UInt64)

func clear()

Clear all fields, leaving an invalid ID.

Declaration
Swift
public mutating func clear()

func createBlankAnonLogon(universe: Universe)

Create an anonymous game server login to be filled in by the AM

Declaration
Swift
public mutating func createBlankAnonLogon(universe: Universe)

func createBlankAnonUserLogon(universe: Universe)

Create an anonymous game server login to be filled in by the AM

Declaration
Swift
public mutating func createBlankAnonUserLogon(universe: Universe)

Well-known Steam IDs

static var nil: SteamID

Generic invalid SteamID

Declaration
Swift
public static let `nil`: SteamID

static var outOfDateGS: SteamID

This steamID comes from a user game connection to an out of date GS that hasnt implemented the protocol to provide its steamID

Declaration
Swift
public static let outOfDateGS: SteamID

static var lanModeGS: SteamID

This steamID comes from a user game connection to an sv_lan GS

Declaration
Swift
public static let lanModeGS: SteamID

static var notInitYetGS: SteamID

This steamID can come from a user game connection to a GS that has just booted but hasnt yet even initialized its steam3 component and started logging on.

Declaration
Swift
public static let notInitYetGS: SteamID

static var nonSteamGS: SteamID

This steamID can come from a user game connection to a GS that isn’t using the steam authentication system but still wants to support the “Join Game” option in the friends list

Declaration
Swift
public static let nonSteamGS: SteamID

Conformances

static func <(lhs: SteamID, rhs: SteamID) -> Bool

Following steam, ordering is defined on the raw 64-bit numeric value, for whatever good that does.

Declaration
Swift
public static func < (lhs: SteamID, rhs: SteamID) -> Bool

var description: String

A human-readable description of the Steam ID

Declaration
Swift
public var description: String { get }