CMTag is used to label something about a resource or other media construct. A CMTag contains a category and a value to represent a particular tag that might be assigned to or associated with another resource. There is only one of each of the category and the value so any notion of "has" is about the respective singular element. CMTags carry a single value that can be carried in 64 bits. This can include data types such as signed 64-bit integers, floating point values fitting in 64 bits, up to 64 bit of flags, and other data types fitting within 64 bits. A CMTag value should not be used to carry pointers or objects. If such a reference is needed, it is okay to carry an index into an out-of-band data structure that itself has a memory reference or an object reference.
Initializes a CMTag instance for a stereoView tag with the specified value.
- Parameters:
- value: The value for the tag.
get · iOS 17.0+
description
TypeScript
get description(): string
Swift declaration
var description: String { get }
A textual representation of this instance.
Calling this property directly is discouraged. Instead, convert an
instance of any type to a string by using the `String(describing:)`
initializer. This initializer works with any type, and uses the custom
`description` property for types that conform to
`CustomStringConvertible`:
struct Point: CustomStringConvertible {
let x: Int, y: Int
var description: String {
return "(\(x), \(y))"
}
}
let p = Point(x: 21, y: 30)
let s = String(describing: p)
print(s)
// Prints "(21, 30)"
The conversion of `p` to a string in the assignment to `s` uses the
`Point` type's `description` property.
Initializes a CMTag instance with the specified category and value.
- Parameters:
- category: The category to use for the CMTag.
- rawTagValue: The value to use for the CMTag.
func value<T>(onlyIfMatching category: CMTypedTag<T>.Category) -> T? where T : Sendable
Returns the strongly typed value for a tag if it matches the specified category. Returns nil if the category of the tag doesn't match the specified category.
- Parameters:
- category: The category to match.