Initializer

init(name:create:)

Returns a pasteboard identified by name, optionally creating it if it doesn’t exist.

Declaration

init?(name pasteboardName: UIPasteboard.Name, create: Bool)

Parameters

pasteboardName

A string or string constant that identifies (or should identify) the pasteboard.

To create a pasteboard with a nil name, specify a nil value for this parameter.

create

A Boolean value that indicates whether the pasteboard should be created if it doesn’t already exist. Specify false for system pasteboards or if you want an existing app pasteboard.

Return Value

A pasteboard object that can be used for transferring data within an app or between apps that have the same team ID.

Discussion

Call this method to create custom app pasteboards. (You can also use it to obtain the general pasteboard, but the general class method exists for that purpose.) App pasteboards returned by this method are not persistent, existing only until the app quits. Starting in iOS 10, persistent named pasteboards are deprecated. Instead use a shared container, as described in the overview for the UIPasteboard class.

See Also

Getting and Removing Pasteboards

class var general: UIPasteboard

Returns the systemwide general pasteboard, which is used for general copy-paste operations

class func withUniqueName() -> UIPasteboard

Returns an app pasteboard identified by a unique system-generated name.

class func remove(withName: UIPasteboard.Name)

Invalidates the designated app pasteboard.