CBLDatabase.filter not called during push replication

I am trying to filter out some documents from getting pushed, however the filter function does not get called. Any thoughts on why it would not be getting called?

func startReplication(ofDatabase database : CBLDatabase, withCredentials credentials : SyncGatewayCredentials) {
    
    guard let url = credentials.syncGatewayURL else {
        finish(withError: SpexError(context: .syncGatewayCredentialsNotFound))
        return
    }
    
    let username = credentials.username
    let password = credentials.password
    let authenticator = CBLAuthenticator.basicAuthenticator(withName: username, password: password)
    
    if mode == .pull {
        replication = database.createPullReplication(url)
    } else {
        replication = database.createPushReplication(url)
        database.setFilterNamed("foo") { (rev, doc) -> Bool in
            print("filter")
            return true
        }
    }
    
    replication?.continuous = false
    replication?.authenticator = authenticator
    
    NotificationCenter.default.addObserver(self, selector: #selector(ReplicateUserDatabaseProcedure.replicationChanged(notification:)), name: NSNotification.Name.cblReplicationChange, object: replication)
    
    replication?.start()
}

You have only created the filter, but not specified that the replication should use it (see filter property on the replication class)