Structure

NWTXTRecord

A dictionary representing a TXT record in a DNS packet.

Declaration

struct NWTXTRecord

Topics

Creating TXT Records

init([String : String])

Initializes a TXT record with a dictionary of strings.

func removeEntry(key: String) -> Bool

Removes an entry from a TXT record dictionary.

func setEntry(NWTXTRecord.Entry, for: String) -> Bool

Sets an entry in a TXT record dictionary.

enum NWTXTRecord.Entry

A type of entry in a TXT record dictionary.

Examining TXT Records

func getEntry(for: String) -> NWTXTRecord.Entry?

Accesses an entry in a TXT record dictionary.

subscript(String) -> String?

Get and set values in a TXT record dictionary, by keys.

var dictionary: [String : String]

The TXT record as a dictionary of strings.

subscript(NWTXTRecord.Index) -> NWTXTRecord.Element

Get and set values in a TXT record dictionary, by index.

typealias NWTXTRecord.Element

A container for a TXT record key and entry value.

Instance Properties

var count: Int

The number of elements in the collection.

var first: (key: String, value: NWTXTRecord.Entry)?

The first element of the collection.

var indices: DefaultIndices<NWTXTRecord>

The indices that are valid for subscripting the collection, in ascending order.

var isEmpty: Bool

A Boolean value indicating whether the collection is empty.

var lazy: LazySequence<NWTXTRecord>

A sequence containing the same elements as this sequence, but on which some operations, such as map and filter, are implemented lazily.

var underestimatedCount: Int

A value less than or equal to the number of elements in the collection.

Instance Methods

func allSatisfy(((key: String, value: NWTXTRecord.Entry)) -> Bool) -> Bool

Returns a Boolean value indicating whether every element of a sequence satisfies a given predicate.

func compactMap<ElementOfResult>(((key: String, value: NWTXTRecord.Entry)) -> ElementOfResult?) -> [ElementOfResult]

Returns an array containing the non-nil results of calling the given transformation with each element of this sequence.

func contains(where: ((key: String, value: NWTXTRecord.Entry)) -> Bool) -> Bool

Returns a Boolean value indicating whether the sequence contains an element that satisfies the given predicate.

func drop(while: ((key: String, value: NWTXTRecord.Entry)) -> Bool) -> Slice<NWTXTRecord>

Returns a subsequence by skipping elements while predicate returns true and returning the remaining elements.

func dropFirst(Int) -> Slice<NWTXTRecord>

Returns a subsequence containing all but the given number of initial elements.

func dropLast(Int) -> Slice<NWTXTRecord>

Returns a subsequence containing all but the specified number of final elements.

func elementsEqual<OtherSequence>(OtherSequence, by: ((key: String, value: NWTXTRecord.Entry), OtherSequence.Element) -> Bool) -> Bool

Returns a Boolean value indicating whether this sequence and another sequence contain equivalent elements in the same order, using the given predicate as the equivalence test.

func enumerated() -> EnumeratedSequence<NWTXTRecord>

Returns a sequence of pairs (n, x), where n represents a consecutive integer starting at zero and x represents an element of the sequence.

func filter(((key: String, value: NWTXTRecord.Entry)) -> Bool) -> [(key: String, value: NWTXTRecord.Entry)]

Returns an array containing, in order, the elements of the sequence that satisfy the given predicate.

func first(where: ((key: String, value: NWTXTRecord.Entry)) -> Bool) -> (key: String, value: NWTXTRecord.Entry)?

Returns the first element of the sequence that satisfies the given predicate.

func firstIndex(where: ((key: String, value: NWTXTRecord.Entry)) -> Bool) -> NWTXTRecord.Index?

Returns the first index in which an element of the collection satisfies the given predicate.

func flatMap<SegmentOfResult>(((key: String, value: NWTXTRecord.Entry)) -> SegmentOfResult) -> [SegmentOfResult.Element]

Returns an array containing the concatenated results of calling the given transformation with each element of this sequence.

func forEach(((key: String, value: NWTXTRecord.Entry)) -> Void)

Calls the given closure on each element in the sequence in the same order as a for-in loop.

func formIndex(inout NWTXTRecord.Index, offsetBy: Int)

Offsets the given index by the specified distance.

func formIndex(inout NWTXTRecord.Index, offsetBy: Int, limitedBy: NWTXTRecord.Index) -> Bool

Offsets the given index by the specified distance, or so that it equals the given limiting index.

func formIndex(after: inout NWTXTRecord.Index)

Replaces the given index with its successor.

func index(NWTXTRecord.Index, offsetBy: Int) -> NWTXTRecord.Index

Returns an index that is the specified distance from the given index.

func index(NWTXTRecord.Index, offsetBy: Int, limitedBy: NWTXTRecord.Index) -> NWTXTRecord.Index?

Returns an index that is the specified distance from the given index, unless that distance is beyond a given limiting index.

func lexicographicallyPrecedes<OtherSequence>(OtherSequence, by: ((key: String, value: NWTXTRecord.Entry), (key: String, value: NWTXTRecord.Entry)) -> Bool) -> Bool

Returns a Boolean value indicating whether the sequence precedes another sequence in a lexicographical (dictionary) ordering, using the given predicate to compare elements.

func makeIterator() -> IndexingIterator<NWTXTRecord>

Returns an iterator over the elements of the collection.

func map<T>(((key: String, value: NWTXTRecord.Entry)) -> T) -> [T]

Returns an array containing the results of mapping the given closure over the sequence’s elements.

func max(by: ((key: String, value: NWTXTRecord.Entry), (key: String, value: NWTXTRecord.Entry)) -> Bool) -> (key: String, value: NWTXTRecord.Entry)?

Returns the maximum element in the sequence, using the given predicate as the comparison between elements.

func min(by: ((key: String, value: NWTXTRecord.Entry), (key: String, value: NWTXTRecord.Entry)) -> Bool) -> (key: String, value: NWTXTRecord.Entry)?

Returns the minimum element in the sequence, using the given predicate as the comparison between elements.

func prefix(Int) -> Slice<NWTXTRecord>

Returns a subsequence, up to the specified maximum length, containing the initial elements of the collection.

func prefix(through: NWTXTRecord.Index) -> Slice<NWTXTRecord>

Returns a subsequence from the start of the collection through the specified position.

func prefix(upTo: NWTXTRecord.Index) -> Slice<NWTXTRecord>

Returns a subsequence from the start of the collection up to, but not including, the specified position.

func prefix(while: ((key: String, value: NWTXTRecord.Entry)) -> Bool) -> Slice<NWTXTRecord>

Returns a subsequence containing the initial elements until predicate returns false and skipping the remaining elements.

func randomElement() -> (key: String, value: NWTXTRecord.Entry)?

Returns a random element of the collection.

func randomElement<T>(using: inout T) -> (key: String, value: NWTXTRecord.Entry)?

Returns a random element of the collection, using the given generator as a source for randomness.

func reduce<Result>(Result, (Result, (key: String, value: NWTXTRecord.Entry)) -> Result) -> Result

Returns the result of combining the elements of the sequence using the given closure.

func reduce<Result>(into: Result, (inout Result, (key: String, value: NWTXTRecord.Entry)) -> ()) -> Result

Returns the result of combining the elements of the sequence using the given closure.

func reversed() -> [(key: String, value: NWTXTRecord.Entry)]

Returns an array containing the elements of this sequence in reverse order.

func shuffled() -> [(key: String, value: NWTXTRecord.Entry)]

Returns the elements of the sequence, shuffled.

func shuffled<T>(using: inout T) -> [(key: String, value: NWTXTRecord.Entry)]

Returns the elements of the sequence, shuffled using the given generator as a source for randomness.

func sorted(by: ((key: String, value: NWTXTRecord.Entry), (key: String, value: NWTXTRecord.Entry)) -> Bool) -> [(key: String, value: NWTXTRecord.Entry)]

Returns the elements of the sequence, sorted using the given predicate as the comparison between elements.

func split(maxSplits: Int, omittingEmptySubsequences: Bool, whereSeparator: ((key: String, value: NWTXTRecord.Entry)) -> Bool) -> [Slice<NWTXTRecord>]

Returns the longest possible subsequences of the collection, in order, that don’t contain elements satisfying the given predicate.

func starts<PossiblePrefix>(with: PossiblePrefix, by: ((key: String, value: NWTXTRecord.Entry), PossiblePrefix.Element) -> Bool) -> Bool

Returns a Boolean value indicating whether the initial elements of the sequence are equivalent to the elements in another sequence, using the given predicate as the equivalence test.

func suffix(Int) -> Slice<NWTXTRecord>

Returns a subsequence, up to the given maximum length, containing the final elements of the collection.

func suffix(from: NWTXTRecord.Index) -> Slice<NWTXTRecord>

Returns a subsequence from the specified position to the end of the collection.

func withContiguousStorageIfAvailable<R>((UnsafeBufferPointer<(key: String, value: NWTXTRecord.Entry)>) -> R) -> R?

Call body(p), where p is a pointer to the collection’s contiguous storage. If no such storage exists, it is first created. If the collection does not support an internal representation in a form of contiguous storage, body is not called and nil is returned.

Subscripts

subscript<R>(R) -> Slice<NWTXTRecord>

Accesses the contiguous subrange of the collection’s elements specified by a range expression.

subscript(Range<NWTXTRecord.Index>) -> Slice<NWTXTRecord>

Accesses a contiguous subrange of the collection’s elements.

See Also

Evaluating Browser Results

let endpoint: NWEndpoint

The discovered service endpoint.

let interfaces: [NWInterface]

The list of interfaces on which the service was discovered.

let metadata: NWBrowser.Result.Metadata

The metadata associated with the discovered service, such as the TXT record.

enum NWBrowser.Result.Metadata

Values associated with discovered services, such as TXT records.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software