<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKContentWorld/world(name:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WKContentWorld(cm)worldWithName:"
  },
  "title" : "world(name:)"
}
-->

# world(name:)

Returns the custom content world with the specified name.

```
class func world(name: String) -> WKContentWorld
```

## Parameters

`name`

The name of the content world you want. If no content world with that name exists, this method creates a new [`WKContentWorld`](/documentation/WebKit/WKContentWorld) object and returns it. The next time you request a content world with the same name, this method returns the object it previously created.

## Return Value

The content world with the specified name.

## Discussion

Use this method to create unique content worlds for your script code. For example, if you execute scripts from multiple JavaScript extensions, you might use this method to create a content world based on a unique string associated with that extension.

---

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)