SFSRoomVariable Class Reference
Inherits from | SFSUserVariable : NSObject |
Conforms to | RoomVariable |
Declared in | SFSRoomVariable.h SFSRoomVariable.m |
Overview
The RoomVariable class is used to represent variables maintained on the Server side and automatically updated to the clients.
They are particularly useful to “attach” any custom data to each Room such as the current game status and other Room-specific properties etc…
RoomVariables support basic data types and nested complex objects:
- Null
- Bool
- Int
- Double
- String
- SFSObject
- SFSArray
RoomVariables also support different flags:
- Private: a private variable can only be modified by its creator
- Persistent: a persistent variable will continue to exist even if its creator has left the room.
- Global: a global variable will fire updates not only to all Users in the Room but also to all Users in the Room Group
Tasks
-
isPersistent
Checks if the variable is persistent.
property -
isPrivate
Checks if the variable is private.
property -
+ variableWithName:value:type:
the name of the variable
Properties
Class Methods
variableWithName:value:type:
the name of the variable
+ (id<RoomVariable>)variableWithName:(NSString *)name value:(id)value type:(NSInteger)type
Parameters
- name
the name of the variable
- value
the variable value ( can be Boolean, int, Number, String, SFSObject, SFSArray )
- type
(optional: -1) it’s usually not necessary to pass this parameter as the variable value is auto-detected
Declared In
SFSRoomVariable.h