Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux-swift latest

Options.init(arrayLiteral:)

Creates a set containing the elements of the given array literal.

Source and package
Qualified name
RegexPattern.Options.init(arrayLiteral:)
Module
RegexPattern
Declared in
Options
Package
libtmux-swift
init(arrayLiteral: Self.Element...)

Inherited from SetAlgebra.init(arrayLiteral:)

Description#

Do not call this initializer directly. It is used by the compiler when you use an array literal. Instead, create a new set using an array literal as its value by enclosing a comma-separated list of values in square brackets. You can use an array literal anywhere a set is expected by the type context.

Here, a set of strings is created from an array literal holding only strings:

let ingredients: Set = ["cocoa beans", "sugar", "cocoa butter", "salt"] if ingredients.isSuperset(of: ["sugar", "salt"]) { print("Whatever it is, it's bound to be delicious!") } // Prints "Whatever it is, it's bound to be delicious!"

  • Parameter arrayLiteral: A list of elements of the new set.
Parameters
Esc

Type to search.

Reference previewOpen reference