Skip to content

Commit

Permalink
Use BitMaskOptionSet instead of Set
Browse files Browse the repository at this point in the history
  • Loading branch information
colemancda committed Dec 11, 2017
1 parent a40f2db commit 8937c33
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
3 changes: 0 additions & 3 deletions Sources/ATT.swift
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,7 @@ public enum ATTAttributePermission: UInt8, BitMaskOption {
.authorized,
.noAuthorization]

#if swift(>=3.1)
#elseif swift(>=3.0)
public typealias RawValue = UInt8
#endif
}


2 changes: 1 addition & 1 deletion Sources/BitMaskOption.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public extension BitMaskOption {
@inline(__always)
static func from(flags: RawValue) -> Set<Self> {

#if swift(>=4.0) || swift(>=3.2)
#if swift(>=4.0)
return Self.all.filter({ $0.isContained(in: flags) })
#elseif swift(>=3.0.2)
return Set(Array(Self.all).filter({ $0.isContained(in: flags) }))
Expand Down
3 changes: 0 additions & 3 deletions Sources/GATT.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,7 @@ public struct GATT {
.signedWrite,
.extendedProperties]

#if swift(>=3.1)
#elseif swift(>=3.0)
public typealias RawValue = UInt8
#endif
}

/// GATT Characteristic Extended Properties Bitfield values.
Expand Down
12 changes: 6 additions & 6 deletions Sources/GATTAttributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ public extension GATT {

public var value: Data

public var permissions: [Permission]
public var permissions: BitMaskOptionSet<Permission>

public var properties: [Property]
public var properties: BitMaskOptionSet<Property>

public var descriptors: [Descriptor]

public init(uuid: BluetoothUUID = BluetoothUUID(),
value: Data = Data(),
permissions: [Permission] = [],
properties: [Property] = [],
permissions: BitMaskOptionSet<Permission> = [],
properties: BitMaskOptionSet<Property> = [],
descriptors: [Descriptor] = []) {

self.uuid = uuid
Expand All @@ -78,11 +78,11 @@ public extension GATT {

public var value: Data

public var permissions: [Permission]
public var permissions: BitMaskOptionSet<Permission>

public init(uuid: BluetoothUUID = BluetoothUUID(),
value: Data = Data(),
permissions: [Permission] = []) {
permissions: BitMaskOptionSet<Permission> = []) {

self.uuid = uuid
self.value = value
Expand Down

0 comments on commit 8937c33

Please sign in to comment.