20 lines
383 B
Swift
20 lines
383 B
Swift
//
|
|
// NSData+int8.swift
|
|
// PillTracker
|
|
//
|
|
// Created by Max Hunt on 16/01/2021.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension Data {
|
|
static func dataWithValue(value: Int8) -> Data {
|
|
var variableValue = value
|
|
return Data(buffer: UnsafeBufferPointer(start: &variableValue, count: 1))
|
|
}
|
|
|
|
func int8Value() -> Int8 {
|
|
return Int8(bitPattern: self[0])
|
|
}
|
|
}
|