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

# init(element:fromLogicalValueTruncatingIfNeeded:timestamp:)

Creates a HID element value from a logical value.

## Declaration

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

## Parameters

- `element`: The element associated with this value.
- `fromLogicalValueTruncatingIfNeeded`: 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 raw value and physical value are calculated; both must 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:fromIntegerTruncatingIfNeeded:timestamp:)](corehid/hidelement/value/init(element:fromintegertruncatingifneeded:timestamp:).md)
- [element](corehid/hidelement/value/element.md)
