Skip to main content
API Reference SwiftyNsdk

NsdkInputDataFlags

Flags indicating which types of input data are required by NSDK....

Declaration

struct NsdkInputDataFlags

Summary

Flags indicating which types of input data are required by NSDK. NsdkInputDataFlags is an option set that specifies which data types should be included in frames sent to NSDK. Use getRequestedDataInputs() to determine which data is currently needed, then include only the requested data types in your frame data for optimal performance.

Overview

NSDK features dynamically request different types of input data based on:

  • Which features are active (VPS, WPS, scanning, mapping)
  • Current processing state and requirements
  • Device capabilities and available sensors

Example Usage

let requiredInputs = nsdkSession.getRequestedDataInputs()
var frameData = NsdkFrameData()
if requiredInputs.contains(.pose) {
frameData.cameraTransform = currentPose
}
if requiredInputs.contains(.cameraImage) {
frameData.cameraPlane0 = cameraPlane
}
if requiredInputs.contains(.platformDepth) {
frameData.depthData = depthBuffer
}
nsdkSession.sendFrame(frameData)

Constructors

Constructor

init()

Summary

Creates an empty option set.
This initializer creates an option set with a raw value of zero.


Overload 1

init(arrayLiteral: Self.Element...)

Summary

Creates a set containing the elements of the given array literal.
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.


Overload 2

init(rawValue: UInt32)

Summary

Creates input data flags with the specified raw value.
- Parameter rawValue: The raw flags value


Overload 3

init<S>(_ sequence: S) where S : Sequence, Self.Element == S.Element

Summary

Creates a new set from a finite sequence of items.
Use this initializer to create a new set from an existing sequence, like
an array or a range:
let validIndices = Set(0..<7).subtracting([2, 4, 5])
print(validIndices)
// Prints "[6, 0, 1, 3]"
- Parameter sequence: The elements to use as members of the new set.


Properties

NameTypeSummary
static let cameraImageNsdkInputDataFlags
Camera image data is required.
This includes the color camera image planes and associated
metadata like intrinsics and timestamps.
static let compassNsdkInputDataFlags
Compass heading data is required.
This includes magnetic and true heading information
from the device's magnetometer and compass.
var descriptionString
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.
static let deviceOrientationNsdkInputDataFlags
Device screen orientation is required.
This indicates the physical orientation of the device screen,
used for proper alignment of AR content.
static let gpsLocationNsdkInputDataFlags
GPS location data is required.
This includes latitude, longitude, altitude, and accuracy
information from the device's location services.
var isEmptyBool
A Boolean value that indicates whether the set has no elements.
static let noneNsdkInputDataFlags
No input data is required.
This indicates that NSDK doesn't currently need any input data,
which may occur when all features are stopped or inactive.
static let platformDepthNsdkInputDataFlags
Platform depth data is required.
This includes depth measurements and confidence data
from LiDAR or structured light depth sensors.
static let poseNsdkInputDataFlags
Device pose (position and orientation) is required.
This includes the camera transform matrix that defines the device's
position and orientation in world coordinate space.
let rawValueUInt32
The raw value representing the input data flags.
static let trackingStateNsdkInputDataFlags
ARKit tracking state is required.
This provides information about the quality and reliability
of the device's pose tracking system.

Methods

NameTypeSummary
containsBool
Returns a Boolean value that indicates whether a given element is a
member of the option set.
This example uses the contains(_:) method to check whether next-day
shipping is in the availableOptions instance.
let availableOptions = ShippingOptions.express
if availableOptions.contains(.nextDay) {
print("Next day shipping available")
}
// Prints "Next day shipping available"
- Parameter member: The element to look for in the option set.
- Returns: true if the option set contains member; otherwise,
false.
mutating formIntersectionvoid
Removes all elements of this option set that are not
also present in the given set.
This method is implemented as a &amp; (bitwise AND) operation on the
two sets' raw values.
- Parameter other: An option set.
mutating formSymmetricDifferencevoid
Replaces this set with a new set containing all elements
contained in either this set or the given set, but not in both.
This method is implemented as a ^ (bitwise XOR) operation on the two
sets' raw values.
- Parameter other: An option set.
mutating formUnionvoid
Inserts the elements of another set into this option set.
This method is implemented as a | (bitwise OR) operation on the
two sets' raw values.
- Parameter other: An option set.
@discardableResult mutating insert(inserted: Bool, memberAfterInsert: Self.Element)
Adds the given element to the option set if it is not already a member.
In the following example, the .secondDay shipping option is added to
the freeOptions option set if purchasePrice is greater than 50.0. For
the ShippingOptions declaration, see the OptionSet protocol
discussion.
let purchasePrice = 87.55
var freeOptions: ShippingOptions = [.standard, .priority]
if purchasePrice > 50 {
freeOptions.insert(.secondDay)
}
print(freeOptions.contains(.secondDay))
// Prints "true"
- Parameter newMember: The element to insert.
- Returns: (true, newMember) if newMember was not contained in
self. Otherwise, returns (false, oldMember), where oldMember is
the member of the set equal to newMember.
intersectionSelf
Returns a new option set with only the elements contained in both this
set and the given set.
This example uses the intersection(_:) method to limit the available
shipping options to what can be used with a PO Box destination.
// Can only ship standard or priority to PO Boxes
let poboxShipping: ShippingOptions = [.standard, .priority]
let memberShipping: ShippingOptions =
[.standard, .priority, .secondDay]
let availableOptions = memberShipping.intersection(poboxShipping)
print(availableOptions.contains(.priority))
// Prints "true"
print(availableOptions.contains(.secondDay))
// Prints "false"
- Parameter other: An option set.
- Returns: A new option set with only the elements contained in both this
set and other.
isDisjointBool
Returns a Boolean value that indicates whether the set has no members in
common with the given set.
In the following example, the employees set is disjoint with the
visitors set because no name appears in both sets.
let employees: Set = ["Alicia", "Bethany", "Chris", "Diana", "Eric"]
let visitors: Set = ["Marcia", "Nathaniel", "Olivia"]
print(employees.isDisjoint(with: visitors))
// Prints "true"
- Parameter other: A set of the same type as the current set.
- Returns: true if the set has no elements in common with other;
otherwise, false.
isStrictSubsetBool
Returns a Boolean value that indicates whether this set is a strict
subset of the given set.
Set A is a strict subset of another set B if every member of A is
also a member of B and B contains at least one element that is not a
member of A.
let employees: Set = ["Alicia", "Bethany", "Chris", "Diana", "Eric"]
let attendees: Set = ["Alicia", "Bethany", "Diana"]
print(attendees.isStrictSubset(of: employees))
// Prints "true"
// A set is never a strict subset of itself:
print(attendees.isStrictSubset(of: attendees))
// Prints "false"
- Parameter other: A set of the same type as the current set.
- Returns: true if the set is a strict subset of other; otherwise,
false.
isStrictSupersetBool
Returns a Boolean value that indicates whether this set is a strict
superset of the given set.
Set A is a strict superset of another set B if every member of B is
also a member of A and A contains at least one element that is not
a member of B.
let employees: Set = ["Alicia", "Bethany", "Chris", "Diana", "Eric"]
let attendees: Set = ["Alicia", "Bethany", "Diana"]
print(employees.isStrictSuperset(of: attendees))
// Prints "true"
// A set is never a strict superset of itself:
print(employees.isStrictSuperset(of: employees))
// Prints "false"
- Parameter other: A set of the same type as the current set.
- Returns: true if the set is a strict superset of other; otherwise,
false.
isSubsetBool
Returns a Boolean value that indicates whether the set is a subset of
another set.
Set A is a subset of another set B if every member of A is also a
member of B.
let employees: Set = ["Alicia", "Bethany", "Chris", "Diana", "Eric"]
let attendees: Set = ["Alicia", "Bethany", "Diana"]
print(attendees.isSubset(of: employees))
// Prints "true"
- Parameter other: A set of the same type as the current set.
- Returns: true if the set is a subset of other; otherwise, false.
isSupersetBool
Returns a Boolean value that indicates whether the set is a superset of
the given set.
Set A is a superset of another set B if every member of B is also a
member of A.
let employees: Set = ["Alicia", "Bethany", "Chris", "Diana", "Eric"]
let attendees: Set = ["Alicia", "Bethany", "Diana"]
print(employees.isSuperset(of: attendees))
// Prints "true"
- Parameter other: A set of the same type as the current set.
- Returns: true if the set is a superset of other; otherwise,
false.
@discardableResult mutating removeSelf.Element?
Removes the given element and all elements subsumed by it.
In the following example, the .priority shipping option is removed from
the options option set. Attempting to remove the same shipping option
a second time results in nil, because options no longer contains
.priority as a member.
var options: ShippingOptions = [.secondDay, .priority]
let priorityOption = options.remove(.priority)
print(priorityOption == .priority)
// Prints "true"
print(options.remove(.priority))
// Prints "nil"
In the next example, the .express element is passed to remove(_:).
Although .express is not a member of options, .express subsumes
the remaining .secondDay element of the option set. Therefore,
options is emptied and the intersection between .express and
options is returned.
let expressOption = options.remove(.express)
print(expressOption == .express)
// Prints "false"
print(expressOption == .secondDay)
// Prints "true"
- Parameter member: The element of the set to remove.
- Returns: The intersection of [member] and the set, if the
intersection was nonempty; otherwise, nil.
mutating subtractvoid
Removes the elements of the given set from this set.
In the following example, the elements of the employees set that are
also members of the neighbors set are removed. In particular, the
names "Bethany" and "Eric" are removed from employees.
var employees: Set = ["Alicia", "Bethany", "Chris", "Diana", "Eric"]
let neighbors: Set = ["Bethany", "Eric", "Forlani", "Greta"]
employees.subtract(neighbors)
print(employees)
// Prints "["Diana", "Chris", "Alicia"]"
- Parameter other: A set of the same type as the current set.
subtractingSelf
Returns a new set containing the elements of this set that do not occur
in the given set.
In the following example, the nonNeighbors set is made up of the
elements of the employees set that are not elements of neighbors:
let employees: Set = ["Alicia", "Bethany", "Chris", "Diana", "Eric"]
let neighbors: Set = ["Bethany", "Eric", "Forlani", "Greta"]
let nonNeighbors = employees.subtracting(neighbors)
print(nonNeighbors)
// Prints "["Diana", "Chris", "Alicia"]"
- Parameter other: A set of the same type as the current set.
- Returns: A new set.
symmetricDifferenceSelf
Returns a new option set with the elements contained in this set or in
the given set, but not in both.
- Parameter other: An option set.
- Returns: A new option set with only the elements contained in either
this set or other, but not in both.
unionSelf
Returns a new option set of the elements contained in this set, in the
given set, or in both.
This example uses the union(_:) method to add two more shipping options
to the default set.
let defaultShipping = ShippingOptions.standard
let memberShipping = defaultShipping.union([.secondDay, .priority])
print(memberShipping.contains(.priority))
// Prints "true"
- Parameter other: An option set.
- Returns: A new option set made up of the elements contained in this
set, in other, or in both.
@discardableResult mutating updateSelf.Element?
Inserts the given element into the set.
If newMember is not contained in the set but subsumes current members
of the set, the subsumed members are returned.
var options: ShippingOptions = [.secondDay, .priority]
let replaced = options.update(with: .express)
print(replaced == .secondDay)
// Prints "true"
- Returns: The intersection of [newMember] and the set if the
intersection was nonempty; otherwise, nil.

Operators

NameTypeSummary
static func != Bool
Returns a Boolean value indicating whether two values are not equal.
Inequality is the inverse of equality. For any values a and b, a != b
implies that a == b is false.
This is the default implementation of the not-equal-to operator (!=)
for any type that conforms to Equatable.
- Parameters:
- lhs: A value to compare.
- rhs: Another value to compare.

Relationships

conforms to: Swift.OptionSet
conforms to: Swift.CustomStringConvertible
conforms to: Swift.Sendable
conforms to: Swift.RawRepresentable
conforms to: Swift.SetAlgebra
conforms to: Swift.SendableMetatype
conforms to: Swift.Equatable
conforms to: Swift.ExpressibleByArrayLiteral