<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/String/init(decoding:)-364r2",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:SS6SystemE8decodingSSAA8FilePathV4RootV_tcfc"
  },
  "title" : "init(decoding:)"
}
-->

# init(decoding:)

On Unix, creates the string `"/"`

```
init(decoding root: FilePath.Root)
```

## Parameters

`root`

The path root to be interpreted as
`CInterop.PlatformUnicodeEncoding`.

## Discussion

On Windows, creates a string by interpreting the path root’s content as
UTF-16.

If the content of the path root isn’t a well-formed Unicode string,
this initializer replaces invalid bytes with U+FFFD.
This means that on Windows,
conversion to a string and back to a path root
might result in a value that’s different from the original path root.

---

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)