---
title: "init(element:fromIntegerTruncatingIfNeeded:timestamp:)"
framework: corehid
role: symbol
role_heading: Initializer
path: "corehid/hidelement/value/init(element:fromintegertruncatingifneeded:timestamp:)"
---

# init(element:fromIntegerTruncatingIfNeeded:timestamp:)

Creates an HID element value from an integer.

## Declaration

```swift
init<IntegerType>(element: HIDElement, fromIntegerTruncatingIfNeeded: IntegerType, timestamp: SuspendingClock.Instant) where IntegerType : FixedWidthInteger
```

## Parameters

- `element`: The element associated with this value.
- `fromIntegerTruncatingIfNeeded`: An integer to use for the value’s doc://com.apple.CoreHID/documentation/CoreHID/HIDElement/Value/bytes, truncating or extending the bytes as necessary.
- `timestamp`: The time that the value was created.

## Discussion

Discussion The logical and physical values are calculated, but don’t need to be valid.

## See Also

### Create a HID element from a value

- [init(element:fromBytes:timestamp:)](corehid/hidelement/value/init(element:frombytes:timestamp:).md)
- [init(element:fromPhysicalValue:timestamp:)](corehid/hidelement/value/init(element:fromphysicalvalue:timestamp:).md)
- [init(element:fromLogicalValueTruncatingIfNeeded:timestamp:)](corehid/hidelement/value/init(element:fromlogicalvaluetruncatingifneeded:timestamp:).md)
- [element](corehid/hidelement/value/element.md)
