CanIOSharedSpace
Class Overview
This class represents any shared space, which can be a space created by the local peer, or a space the local peer has joined. Each space has a number of objects, which can be of various types. This class is used to create and access the shared space's objects, and to invite other peers to the space.
Properties
@property (nonatomic, assign) id <CanIOSharedSpaceDelegate> delegate;
CanIOSharedSpace's delegate, conforming to the CanIOSharedSpaceDelegate protocol. This protocol is used to notify your app of peers that have joined the space, or accepted/rejected invitation to join the space, and about changes in the space's data objects.
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *UUID;
The space's name and UUID.
@property (nonatomic) NSMutableDictionary *objects;
A dictionary containing all of the spaces' data objects, keyed by their name. To access an object called "contacts":
CanIOSharedObject *contactsObject = mySpace.objects[@"contacts"];
Methods
- (void)invitePeer:(CanIOPeer *)peer;
Use this method to invite a peer to the space. You will be notified if the peer accepted or rejected the invitation through CanIOSharedSpaceDelegate's peerDidAcceptInvitation/peerDidRejectInvitation methods.
- (void)addObject:(CanIOSharedObject *)object withName:(NSString *)name;
Use this method to add a newly created CanIOSharedObject to the space. Once added to the space, the newly created object will be synced to all peers connected to the space.