<!--
{
  "availability" : [
    "iOS: 26.2.0 -",
    "iPadOS: 26.2.0 -",
    "macCatalyst: 26.2.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WiFiInfrastructure",
  "identifier" : "/documentation/WiFiInfrastructure/WISSID/init(_:encoding:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Wi-Fi Infrastructure"
    ],
    "preciseIdentifier" : "s:18WiFiInfrastructure6WISSIDV_8encodingACSgSS_SS10FoundationE8EncodingVtcfc"
  },
  "title" : "init(_:encoding:)"
}
-->

# init(_:encoding:)

Creates an SSID from a text string using the specified encoding.

```
init?(_ ssid: String, encoding: String.Encoding = .utf8)
```

## Parameters

`ssid`

The network name as a string.

`encoding`

The text encoding to use for conversion. Defaults to UTF-8.

## Return Value

A new SSID, or `nil` if the string can’t be encoded or results in invalid data length.

## Discussion

Use this initializer to create SSIDs from human-readable network names. The method converts the string to
binary data using the specified encoding before validating against length requirements.

---

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)