init(_:encoding:)
Creates an SSID from a text string using the specified encoding.
Declaration
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.