One Logo Pool Ball
Foundation · IOS API REFERENCE

URLResource

struct · iOS 16.0+ · SDK 27.1

struct URLResource

A resource located at a particular file URL within a bundle. This type is similar to ``LocalizedStringResource`` in its ability to provide access to a resource in a bundle, possibly from another process. Use the ``URL`` initializer ``URL/init(resource:)`` to resolve the resource.

Members (6)

get · iOS 16.0+

subdirectory

TypeScript
get subdirectory(): (string) | null
Swift declaration
let subdirectory: String?

The subdirectory, if any, of the resource.

init · iOS 16.0+

init

TypeScript
static init(name: string, subdirectory?: (string) | null, locale?: Locale, bundle?: Bundle): URLResource
Swift declaration
init(name: String, subdirectory: String? = nil, locale: Locale = .current, bundle: Bundle = .main)

Creates a URL resource from the given bundle, name, and subdirectory, optionally specifying a locale. - Parameters: - name: The name of the resource in the bundle. - subdirectory: The subdirectory, if any, of the resource. - locale: The locale of the resource. - bundle: The bundle containing the resource.

get · iOS 16.0+

name

TypeScript
get name(): string
Swift declaration
let name: String

The name of the resource in the bundle. The `name` property specifies both the resource name and its file extension.

get · iOS 16.0+

bundle

TypeScript
get bundle(): Bundle
Swift declaration
let bundle: Bundle

The bundle containing the resource.

get · iOS 16.0+

locale

TypeScript
get locale(): Locale
Swift declaration
var locale: Locale

The locale of the resource.

set · iOS 16.0+

locale

TypeScript
set locale(value: Locale)
Swift declaration
var locale: Locale

The locale of the resource.

Skipped declarations

No declarations were skipped in this snapshot.

All Foundation types →