---
title: service()
framework: foundation
role: symbol
role_heading: Type Method
path: foundation/nsxpclistener/service()
---

# service()

Returns the singleton listener used to listen for incoming connections in an XPC service.

## Declaration

```swift
class func service() -> NSXPCListener
```

## Discussion

Discussion Calling the resume method on the returned object starts the listener and never returns. This method is typically called at the end of your main function. note: This method requires that the XPC service has the appropriate configuration in its Info.plist file.

## See Also

### Using standard listeners

- [anonymous()](foundation/nsxpclistener/anonymous().md)
