Question: I'm trying to show the replication progress to the user, but so far I can't find a way to retrieve this information. I am using iOS. I know about the changesCount and completedChangesCount from the replication object, but you can't easily convert this to percentage progress as the changesCount keeps increasing while replication is running. Any idea what could be done about this?

Docs for changesCount:
<http://couchbase.github.io/couchbase-lite-ios/docs/html/interfaceCBLReplication.html#a8e2733855342bb6855df8d5b6a97ef81>

Answer: 
If you have a look at Couchbase lite-iOS guide on replication, there's [Observing and monitoring replications](http://developer.couchbase.com/documentation/mobile/1.1.0/develop/guides/couchbase-lite/native-api/replication/index.html#story-h2-6).

You could implement it this way:  

**Objective-C**

```
[[NSNotificationCenter defaultCenter] addObserver: self
                     selector: @selector(replicationChanged:)
                         name: kCBLReplicationChangeNotification
                       object: push];
[[NSNotificationCenter defaultCenter] addObserver: self
                     selector: @selector(replicationChanged:)
                         name: kCBLReplicationChangeNotification
                       object: pull];
- (void) replicationChanged: (NSNotification*)n {
    // The replication reporting the notification is n.object , but we
    // want to look at the aggregate of both the push and pull.

    // First check whether replication is currently active:
    BOOL active = (pull.status == kCBLReplicationActive) || (push.status == kCBLReplicationActive);
    self.activityIndicator.state = active;
    // Now show a progress indicator:
    self.progressBar.hidden = !active;
    if (active) {
        double progress = 0.0;
        double total = push.changesCount + pull.changesCount;
        if (total > 0.0) {
            progress = (push.completedChangesCount + pull.completedChangesCount) / total;
        }
        self.progressBar.progress = progress;
    }
}

```

**Swift:**

```
NSNotificationCenter.defaultCenter().addObserver(self,
    selector: "replicationChanged:",
    name: kCBLReplicationChangeNotification,
    object: push)
NSNotificationCenter.defaultCenter().addObserver(self,
    selector: "replicationChanged:",
    name: kCBLReplicationChangeNotification,
    object: pull)
func replicationProgress(n: NSNotification) {
    // The replication reporting the notification is n.object , but we
    // want to look at the aggregate of both the push and pull.

    // First check whether replication is currently active:
    let active = pull.status == CBLReplicationStatus.Active || push.status == CBLReplicationStatus.Active
    self.activityIndicator.state = active
    // Now show a progress indicator:
    self.progressBar.hidden = !active;
    if active {
        var progress = 0.0
        let total = push.changesCount + pull.changesCount
        let completed = push.completedChangesCount + pull.completedChangesCount
        if total > 0 {
            progress = Double(completed) / Double(total);
        }
        self.progressBar.progress = progress;
    }
}

```

**Note:** A continuous replication will stay active indefinitely, watching for further changes to occur and transferring them. So, I recommend you to read through different types of replication and also, replication state flags.
update Swift3

```
func setupCBL() {

    let manager = CBLManager.sharedInstance()
    CBLManager.enableLogging("Sync")

    do {
        db = try manager.databaseNamed("tiny")
    } catch {
        print("no database")
    }

    if let url = URL(string:serverURL){
        pull = db?.createPullReplication(url)

        push = db?.createPushReplication(url)
    }

    pull?.continuous       = true
    push?.continuous       = true

    NotificationCenter.default.addObserver(self,
                                           selector: #selector(CBLCore.replicationChanged),
                                           name: NSNotification.Name.cblReplicationChange,
                                           object: push)
    NotificationCenter.default.addObserver(self,
                                           selector: #selector(CBLCore.replicationChanged),
                                           name: NSNotification.Name.cblReplicationChange,
                                           object: pull)

    push?.start()
    pull?.start()

}

func replicationChanged(n:Notification)  {

    if (self.push?.status == CBLReplicationStatus.active || self.pull?.status == CBLReplicationStatus.active) {
        let completed   = (self.pull?.completedChangesCount)! + (self.push?.completedChangesCount)!
        let total       = (self.pull?.changesCount)! + (self.push?.changesCount)!
        print("---------------------- in progress ---------------- \(completed) \\ \(total)")
    } else {
        if let error = self.push?.lastError ?? self.pull?.lastError{
            print("Error with code \(error)")
        }

    }
}

```