SFS2X Objective-C API
1.7.13
iOS / macOS / tvOS
|
#import <SFSRoomVariable.h>
Inherits BaseVariable, and <RoomVariable>.
Instance Methods | |
(id< ISFSArray >) | - toSFSArray |
![]() | |
(id) | - initWithName:value:type: |
(id) | - getValue |
(BOOL) | - getBoolValue |
(NSInteger) | - getIntValue |
(NSNumber *) | - getDoubleValue |
(NSString *) | - getStringValue |
(id< ISFSObject >) | - getSFSObjectValue |
(id< ISFSArray >) | - getSFSArrayValue |
(BOOL) | - isNull |
Class Methods | |
(id) | + variableWithName:value:type: |
(id) | + variableWithName:value: |
(id) | + variableWithName:value:isPrivate:isPersistent: |
(id< RoomVariable >) | + fromSFSArray: |
Protected Attributes | |
BOOL | _isPersistent |
BOOL | _isPrivate |
![]() | |
NSString * | _name |
NSString * | _type |
id | _value |
Properties | |
BOOL | isPersistent |
BOOL | isPrivate |
![]() | |
NSString * | name |
NSString * | type |
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:
RoomVariables also support different flags:
+ (id) variableWithName: | (NSString *) | name | |
value: | (id) | value | |
name | the name of the variable |
value | the variable value ( can be BOOL, Integer, Double, String, SFSObject, SFSArray ) |
Reimplemented from BaseVariable.
+ (id) variableWithName: | (NSString *) | name | |
value: | (id) | value | |
isPrivate: | (BOOL) | priv | |
isPersistent: | (BOOL) | pers | |
name | the name of the variable |
value | the variable value ( can be BOOL, Integer, Double, String, SFSObject, SFSArray ) |
priv | indicates whether the variable can be modified by other users or not |
pers | indicates whether the variable is removed from the Room when the user leaves (YES = variable is not removed) |
+ (id) variableWithName: | (NSString *) | name | |
value: | (id) | value | |
type: | (NSInteger) | type | |
name | the name of the variable |
value | the variable value ( can be BOOL, Integer, Double, String, SFSObject, SFSArray ) |
type | (optional -1) it's usually not necessary to pass this parameter as the variable value is auto-detected |
Reimplemented from BaseVariable.
|
readwritenonatomicassign |
Checks if the variable is persistent.
A persistent RoomVariable continues to exist in a Room after the User has left it and until he disconnects
|
readwritenonatomicassign |
Checks if the variable is private.
A private RoomVariable is only modifiable by its owner (the user that created it)