---
title: nextElement()
framework: virtualization
role: symbol
role_heading: Instance Method
path: virtualization/vzvirtioqueue/nextelement()
---

# nextElement()

Gets the next element in this queue, if any.

## Declaration

```swift
func nextElement() -> VZVirtioQueueElement?
```

## Return Value

Return Value The next available element on this queue, or nil if no elements are available or if the device is no longer live.

## Discussion

Discussion Use this method to obtain any elements (available buffers), that the Virtualization framework represents as VZVirtioQueueElement, in the virtqueue for processing. You need to call the returnToQueue() method when you are finished processing the element in order to return the element back to the guest. When using this method, the framework disables virtqueue notifications until you have consumed every available element. When calling this method in response to a virtqueue notification, you need to do so repeatedly until it returns nil (which indicates there are no more elements available in the queue), typically in a loop like this:
