You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Returns an attribute container storing only the attributes in `self` with the `inheritedByAddedText` property set to `true`
111
+
/// Returns a copy of the attribute container with only attributes that specify the provided inheritance behavior.
112
+
/// - Parameter inheritedByAddedText: An `inheritedByAddedText` value to filter. Attributes matching this value are included in the returned container.
113
+
/// - Returns: A copy of the attribute container with only attributes whose `inheritedByAddedText` property matches the provided value.
/// Returns an attribute container storing only the attributes in `self` with a matching run boundary property
124
-
///
125
-
/// Note: if `nil` is provided then only attributes not bound to any particular boundary will be returned
125
+
/// Returns a copy of the attribute container with only attributes that have the provided run boundaries.
126
+
/// - Parameter runBoundaries: The required `runBoundaries` value of the filtered attributes. If `nil` is provided, only attributes not bound to any specific boundary will be returned.
127
+
/// - Returns: A copy of the attribute container with only attributes whose `runBoundaries` property matches the provided value.
/// Tracks the location of the provided range throughout the mutation closure, updating the provided range to one that represents the same effective locations after the mutation. If updating the provided range is not possible (tracking failed) then this function will fatal error. Use the Optional-returning variants to provide custom fallback behavior.
82
+
/// Tracks the location of the provided range throughout the mutation closure, updating the provided range to one that represents the same effective locations after the mutation.
83
+
///
84
+
/// If updating the provided range is not possible (tracking failed) then this function will fatal error. Use the `Optional`-returning variants to provide custom fallback behavior.
83
85
/// - Parameters:
84
-
/// - range: a range to track throughout the `body` closure
85
-
/// - body: a mutating operation, or set of operations, to perform on the value of `self`. The value of `self` is provided to the closure as an `inout AttributedString` that the closure should mutate directly. Do not capture the value of `self` in the provided closure - the closure should mutate the provided `inout` copy.
86
+
/// - range: A range to track throughout the `body` closure.
87
+
/// - body: A mutating operation, or set of operations, to perform on the value of `self`. The value of `self` is provided to the closure as an `inout AttributedString` that the closure should mutate directly. Do not capture the value of `self` in the provided closure - the closure should mutate the provided `inout` copy.
guardlet result =tryself.transform(updating: range, body: body)else{
88
90
fatalError("The provided mutation body did not allow for maintaining index tracking. Ensure that your mutation body mutates the provided AttributedString instead of replacing it with a different AttributedString or use the non-inout version of transform(updating:body:) which returns an Optional value to provide fallback behavior.")
89
91
}
90
92
range = result
91
93
}
92
94
93
-
/// Tracks the location of the provided ranges throughout the mutation closure, updating them to new ranges that represent the same effective locations after the mutation. If updating the provided ranges is not possible (tracking failed) then this function will fatal error. Use the Optional-returning variants to provide custom fallback behavior.
95
+
/// Tracks the location of the provided ranges throughout the mutation closure, updating them to new ranges that represent the same effective locations after the mutation.
96
+
///
97
+
/// If updating the provided ranges is not possible (tracking failed) then this function will fatal error. Use the `Optional`-returning variants to provide custom fallback behavior.
94
98
/// - Parameters:
95
-
/// - ranges: a list of ranges to track throughout the `body` closure. The updated array (after the function is called) is guaranteed to be the same size as the provided array. Updated ranges are located at the same indices as their respective original ranges in the input `ranges` array.
96
-
/// - body: a mutating operation, or set of operations, to perform on the value of `self`. The value of `self` is provided to the closure as an `inout AttributedString` that the closure should mutate directly. Do not capture the value of `self` in the provided closure - the closure should mutate the provided `inout` copy.
99
+
/// - ranges: A list of ranges to track throughout the `body` closure. The updated array (after the function is called) is guaranteed to be the same size as the provided array. Updated ranges are located at the same indices as their respective original ranges in the input `ranges` array.
100
+
/// - body: A mutating operation, or set of operations, to perform on the value of `self`. The value of `self` is provided to the closure as an `inout AttributedString` that the closure should mutate directly. Do not capture the value of `self` in the provided closure - the closure should mutate the provided `inout` copy.
guardlet result =tryself.transform(updating: ranges, body: body)else{
99
103
fatalError("The provided mutation body did not allow for maintaining index tracking. Ensure that your mutation body mutates the provided AttributedString instead of replacing it with a different AttributedString or use the non-inout version of transform(updating:body:) which returns an Optional value to provide fallback behavior.")
/// Tracks the location of the provided range throughout the mutation closure, returning a new, updated range that represents the same effective locations after the mutation
110
+
/// Tracks the location of the provided range throughout the mutation closure, returning a new, updated range that represents the same effective locations after the mutation.
107
111
/// - Parameters:
108
-
/// - range: a range to track throughout the `mutation` block
109
-
/// - mutation: a mutating operation, or set of operations, to perform on this `AttributedString`
110
-
/// - Returns: the updated `Range` that is valid after the mutation has been performed, or `nil` if the mutation performed does not allow for tracking to succeed (such as replacing the provided inout variable with an entirely different AttributedString)
112
+
/// - range: A range to track throughout the `body` block.
113
+
/// - body: A mutating operation, or set of operations, to perform on this `AttributedString`.
114
+
/// - Returns: the updated `Range` that is valid after the mutation has been performed, or `nil` if the mutation performed does not allow for tracking to succeed (such as replacing the provided inout variable with an entirely different `AttributedString`).
/// Tracks the location of the provided ranges throughout the mutation closure, returning a new, updated range that represents the same effective locations after the mutation
116
120
/// - Parameters:
117
-
/// - index: an index to track throughout the `mutation` block
118
-
/// - mutation: a mutating operation, or set of operations, to perform on this `AttributedString`
119
-
/// - Returns: the updated `Range`s that is valid after the mutation has been performed, or `nil` if the mutation performed does not allow for tracking to succeed (such as replacing the provided inout variable with an entirely different AttributedString). When the return value is non-nil, the returned array is guaranteed to be the same size as the provided array with updated ranges at the same Array indices as their respective original ranges in the input array.
121
+
/// - ranges: Ranges to track throughout the `body` block.
122
+
/// - body: A mutating operation, or set of operations, to perform on this `AttributedString`.
123
+
/// - Returns: the updated `Range`s that are valid after the mutation has been performed or `nil` if the mutation performed does not allow for tracking to succeed (such as replacing the provided inout variable with an entirely different `AttributedString`). When the return value is non-`nil`, the returned array is guaranteed to be the same size as the provided array with updated ranges at the same indices as their respective original ranges in the input array.
/// Indicates whether the index is valid for use with the provided attributed string.
49
+
/// - Parameter text: An attributed string used to validate the index.
50
+
/// - Returns: `true` when the index is valid for use with the provided attributed string; otherwise, false. An index is valid if it is both within the bounds of the attributed string and was produced from the provided string without any intermediate mutations.
/// Indicates whether the index is valid for use with the provided discontiguous attributed string.
58
+
/// - Parameter text: A discontiguous attributed string used to validate the index.
59
+
/// - Returns: `true` when the index is valid for use with the provided discontiguous attributed string; otherwise, false. An index is valid if it is both within the bounds of the discontigous attributed string and was produced from the provided string without any intermediate mutations.
/// Indicates whether the range is valid for use with the provided attributed string.
69
+
/// - Parameter text: An attributed string used to validate the range.
70
+
/// - Returns: `true` when the range is valid for use with the provided attributed string; otherwise, false. A range is valid if its lower and upper bounds are each either valid in the attributed string or equivalent to the string's `endIndex`.
// Note: By nature of Range's lowerBound <= upperBound requirement, this is also sufficient to determine that lowerBound <= endIndex && upperBound >= startIndex
/// Indicates whether the range is valid for use with the provided discontiguous attributed string.
80
+
/// - Parameter text: A discontiguous attributed string used to validate the range.
81
+
/// - Returns: `true` when the range is valid for use with the provided discontiguous attributed string; otherwise, false. A range is valid if its lower and upper bounds are each either valid in the discontiguous attributed string or equivalent to the string's `endIndex`.
/// Indicates whether the range set is valid for use with the provided attributed string.
94
+
/// - Parameter text: An attributed string used to validate the range set.
95
+
/// - Returns: `true` when the range set is valid for use with the provided attributed string; otherwise, false. A range set is valid if each of its ranges are valid in the attributed string.
/// Indicates whether the range set is valid for use with the provided discontiguous attributed string.
103
+
/// - Parameter text: A discontigious attributed string used to validate the range set.
104
+
/// - Returns: `true` when the range set is valid for use with the provided discontiguous attributed string; otherwise, false. A range set is valid if each of its ranges are valid in the discontiguous attributed string.
0 commit comments