<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 14.0.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HomeKit",
  "identifier" : "/documentation/HomeKit/HMHome/servicesWithTypes(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "HomeKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HMHome(im)servicesWithTypes:"
  },
  "title" : "servicesWithTypes(_:)"
}
-->

# servicesWithTypes(_:)

Returns an array of all services provided by accessories in the home that match the specified types.

```
func servicesWithTypes(_ serviceTypes: [String]) -> [HMService]?
```

## Parameters

`serviceTypes`

An array of strings that identify service types. See [Accessory Service Types](/documentation/HomeKit/accessory-service-types) for a list of types.

## Return Value

An array of found services. Returns `nil` if no matching services are found.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)