> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/ios/collaboration/samples-i.md).

# Document Collaboration Samples on iOS

Explore Realtime Collaboration with iOS SDK. Download the sample app for Apryse and Firebase servers. Step-by-step guide for seamless annotation sharing between devices. The Apryse iOS SDK streamlines

The iOS SDK includes a realtime collaboration sample app with the .dmg download (found in `Samples/Other/Collaboration`). It includes support for two different back-end servers:

1. A demonstration Apryse collaboration server.
2. Google's [Firebase Realtime Database](https://firebase.google.com/products/realtime-database/)

This guide will step you through running the sample.

[Download .dmg](https://docs.apryse.com/downloads/ios/dmg/PDFNet.dmg)

## Collaborate with the Apryse Demonstration sServer

The Apryse demonstration server uses [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/) to communicate annotation changes and messages between the client and the server. The WebSocket API is provided by [SocketRocket](https://github.com/facebook/SocketRocket/), and is integrated via [CocoaPods](https://guides.cocoapods.org/using/getting-started.html).

1. Open the workspace `Collaboration.xcworkspace`, and run the sample. The device will show the PDF viewer.
2. Check Xcode's sample for a URL you can open in your computer's browser.

Now, when you create annotations on the device or the computer's browser, the annotation will show up on the other.

## Collaborate with Firebase Realtime Database

### Use Apryse's demonstration Firebase database.

Firebase's Realtime Database is a NoSQL database. Accessing firebase requires Google's Firebase SDK, which is integrated via Cocoapods:

1. Open the workspace `Collaboration.xcworkspace`.
2. Open the file ViewController.m, and in the method `-(void)viewDidAppear:(BOOL)animated`, comment out the line of code under "OPTION 1" (which uses the Apryse demonstration server), and uncomment the line under "OPTION 2" (which uses Firebase).
3. Run the sample. The device will show the PDF viewer.
4. Check Xcode's sample for a URL you can open in your computer's browser.

Now, when you create annotations on the device or the computer's browser, the annotation will show up on the other.

### Use a different Firebase database.

The firebase sample can be configured to connect to your own Firebase instance. To do this, follow these instructions:

1. If you have not already done so, create a Firebase account.
2. Using the Firebase console, in the Authentication section, under Sign-in method, enable Anonymous sign-in as a provider.
3. Using the Firebase console, in the Database section, create a new Realtime Database.
4. Using the Firebase console, in Project Settings (found by clicking the gear icon), create a new iOS app. Download its config file ("GoogleService-Info.plist"), and replace the sample's file of the same name with the newly downloaded version.
5. Run the project. If you run the project a second time on a different device or simulator, you can collaborate using the 2 (or more) instances of the app.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/ios/collaboration/samples-i.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
