SFS2X Objective-C API
1.7.13
iOS / macOS / tvOS
|
#import <SFSUserVariable.h>
Inherits BaseVariable, and <UserVariable>.
Instance Methods | |
(BOOL) | - isPrivate |
(void) | - setPrivate: |
(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< UserVariable >) | + fromSFSArray: |
(id< UserVariable >) | + privateVariableWithName:value: |
Additional Inherited Members | |
![]() | |
NSString * | _name |
NSString * | _type |
id | _value |
![]() | |
NSString * | name |
NSString * | type |
The SFSUserVariable object represents a SmartFoxServer User Variable entity on the client. It is a custom value attached to a User object that gets automatically synchronized between client and server on every change.
User Variables are particularly useful to store custom user data that must be "visible" to the other users, such as a profile, a score, a status message, etc. User Variables can be set by means of the SetUserVariablesRequest request; they support the following data types (also nested): Boolean, int, Number, String, SFSObject, SFSArray. A User Variable can also be null
.
Private UserVariables are available since SFS2X 2.12 with client API 1.7 and they allow to limit the visibility of variables marked as private to the owner only. In other words UserVariables marked as private are not sent to other users in the same Room.
- (BOOL) isPrivate |
Indicates whether this User Variable is private or not. A private User Variable is visible only to its owner; any changes made to the variable will be transmitted to the owner only.
NOTE: setting the private property manually on an existing User Variable returned by the API has no effect on the server and can disrupt the API functioning. This flag can be set when the User Variable object is created by the developer only (using the new keyword).
+ (id< UserVariable >) privateVariableWithName: | (NSString *) | name | |
value: | (id) | value | |
+ (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 | |
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.