BuiltUserPresence Class Reference

Inherits from NSObject
Declared in BuiltUserPresence.h

  status

Online and Offline status of the user.

@property (nonatomic, assign, readonly) BuiltRealtimeUserPresenceStatus status

Discussion

 //Obj-C
 BuiltUserPresence *presence = [userObject presence];
 if (presence.status == BuiltRealtimeUserPresenceStatusOnline) {
    //user is online
 }else {
    //user is offline
 }

 //Swift
 var presence:BuiltUserPresence = userObject.presence()
 if (presence.status == BuiltRealtimeUserPresenceStatus.Online) {
    //user is online
 }else {
    //user is offline
 }

Warning: Not supported in watchOS

Declared In

BuiltUserPresence.h

  lastSeen

Last seen timestamp of the user.

@property (nullable, nonatomic, copy, readonly) NSDate *lastSeen

Discussion

 //Obj-C
 BuiltUserPresence *presence = [userObject presence];
 NSDate *lastSeen = presence.lastSeen;

 //Swift
 var presence:BuiltUserPresence = userObject.presence()
 var lastSeen:NSDate = presence.lastSeen()

Warning: Not supported in watchOS

Declared In

BuiltUserPresence.h

  enable

Enable or disable presence. If disabled user presence will not to shown to others.

@property (nonatomic, assign, getter=isEnable) BOOL enable

Discussion

 //Obj-C
 BuiltUserPresence *presence = [userObject presence];
 presence.enable = YES;

 //Swift
 var presence:BuiltUserPresence = userObject.presence()
 presence.enable = true

Warning: Not supported in watchOS

Declared In

BuiltUserPresence.h

– save:

Save presence

- (void)save:(void ( ^ ) ( NSError *BUILT_NULLABLE_P error ))completionBlock

Parameters

completionBlock

block called once save is completed. error object present if occured

Discussion

 //Obj-C
 BuiltUserPresence *presence = [userObject presence];
 [presence save:^(NSError *error) {
     if (error) {
        //some error occured while saving
     }else {
        //presence saved
     }
 }];

 //Swift
 var presence:BuiltUserPresence = userObject.presence()
 builtApplication.currentUser.presence.save { (error) -> Void in
     if (error != nil) {
        //some error occured while saving presence
     }else {
        //presence saved
     }
 }

Warning: Not supported in watchOS

Declared In

BuiltUserPresence.h