Commit f3839a7d authored by Roddi Deecke's avatar Roddi Deecke Committed by Thomas Mellenthin

fix implicit getter violation

parent 93bc2994
......@@ -16,7 +16,6 @@ disabled_rules:
- function_parameter_count
- line_length
- force_cast
- implicit_getter
- todo
- file_length
- function_body_length
......
......@@ -9,57 +9,43 @@ import UIKit
extension Data {
var uint8: UInt8 {
get {
var number: UInt8 = 0
self.copyBytes(to: &number, count: MemoryLayout<UInt8>.size)
return number
}
var number: UInt8 = 0
self.copyBytes(to: &number, count: MemoryLayout<UInt8>.size)
return number
}
var uint16: UInt16 {
get {
let i16array = self.withUnsafeBytes {
UnsafeBufferPointer<UInt16>(start: $0, count: self.count/2).map(UInt16.init(littleEndian:))
}
return i16array[0]
let i16array = self.withUnsafeBytes {
UnsafeBufferPointer<UInt16>(start: $0, count: self.count/2).map(UInt16.init(littleEndian:))
}
return i16array[0]
}
var uint32: UInt32 {
get {
let i32array = self.withUnsafeBytes {
UnsafeBufferPointer<UInt32>(start: $0, count: self.count/2).map(UInt32.init(littleEndian:))
}
return i32array[0]
let i32array = self.withUnsafeBytes {
UnsafeBufferPointer<UInt32>(start: $0, count: self.count/2).map(UInt32.init(littleEndian:))
}
return i32array[0]
}
var uint64: UInt64 {
get {
let i64array = self.withUnsafeBytes {
UnsafeBufferPointer<UInt64>(start: $0, count: self.count/2).map(UInt64.init(littleEndian:))
}
return i64array[0]
let i64array = self.withUnsafeBytes {
UnsafeBufferPointer<UInt64>(start: $0, count: self.count/2).map(UInt64.init(littleEndian:))
}
return i64array[0]
}
var uuid: NSUUID? {
get {
var bytes = [UInt8](repeating: 0, count: self.count)
self.copyBytes(to: &bytes, count: self.count * MemoryLayout<UInt32>.size)
return NSUUID(uuidBytes: bytes)
}
var bytes = [UInt8](repeating: 0, count: self.count)
self.copyBytes(to: &bytes, count: self.count * MemoryLayout<UInt32>.size)
return NSUUID(uuidBytes: bytes)
}
var stringASCII: String? {
get {
return NSString(data: self, encoding: String.Encoding.ascii.rawValue) as String?
}
return NSString(data: self, encoding: String.Encoding.ascii.rawValue) as String?
}
var stringUTF8: String? {
get {
return NSString(data: self, encoding: String.Encoding.utf8.rawValue) as String?
}
return NSString(data: self, encoding: String.Encoding.utf8.rawValue) as String?
}
struct HexEncodingOptions: OptionSet {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment