# How do i observe an Array when append or remove element with Combine?

**URL:** <https://forums.kodeco.com/t/how-do-i-observe-an-array-when-append-or-remove-element-with-combine/196108>\
**Category:** Combine: Asynchronous Programming with Swift\
**Created:** [September 23, 2023, 1:28am UTC](https://forums.kodeco.com/t/how-do-i-observe-an-array-when-append-or-remove-element-with-combine/196108 "2023-09-23T01:28:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![diuming](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/diuming/32/110937_2.png) [@diuming](https://forums.kodeco.com/u/diuming)\
**Post date:** [September 23, 2023, 1:28am UTC](https://forums.kodeco.com/t/how-do-i-observe-an-array-when-append-or-remove-element-with-combine/196108/1 "2023-09-23T01:28:05Z")

</div>

When I adding or removing element in `names` array, no any result. following the code.  
Could you give and advice?

```auto
class SomeClass: NSObject {
    @objc var names = ["A", "B", "C"]
    var cancellable: AnyCancellable?
    
    override init () {
        self.cancellable = names.publisher
            .sink { name in
                print("name: \(name)")
            }
    }
}

let someClass = SomeClass()
someClass.names.removeLast()

// === results ===
// name: A
// name: B
// name: C

```
