---
title: "init(string:)"
framework: virtualization
role: symbol
role_heading: Initializer
path: "virtualization/vzmacaddress/init(string:)"
---

# init(string:)

Creates a MAC address object from a specially formatted string.

## Declaration

```swift
convenience init?(string: String)
```

## Parameters

- `string`: A string that contains the 6 hexadecimal bytes of the MAC address separated by colon characters. An example string is 01:23:45:ab:cd:ef. The string is case-insensitive, so you may use uppercase or lowercase for alphabetical characters.

## Return Value

Return Value A MAC address object with the specified value, or nil if the string is formatted incorrectly.

## See Also

### Creating a MAC address

- [randomLocallyAdministered()](virtualization/vzmacaddress/randomlocallyadministered().md)
- [init(ethernetAddress:)](virtualization/vzmacaddress/init(ethernetaddress:).md)
