Documentation Archive Developer
Search

CoreBluetooth Changes for Swift

CoreBluetooth

Removed CBAttributePermissions.init(_: UInt)
Removed CBCentralManagerDelegate.centralManager(_: CBCentralManager!, didRetrieveConnectedPeripherals: [AnyObject]!)
Removed CBCentralManagerDelegate.centralManager(_: CBCentralManager!, didRetrievePeripherals: [AnyObject]!)
Removed CBCharacteristicProperties.init(_: UInt)
Removed CBMutableCharacteristic.UUID
Removed CBMutableService.isPrimary
Removed CBMutableService.UUID
DeclarationProtocolsRaw Value Type
From
enum CBATTError : Int {
    case Success
    case InvalidHandle
    case ReadNotPermitted
    case WriteNotPermitted
    case InvalidPdu
    case InsufficientAuthentication
    case RequestNotSupported
    case InvalidOffset
    case InsufficientAuthorization
    case PrepareQueueFull
    case AttributeNotFound
    case AttributeNotLong
    case InsufficientEncryptionKeySize
    case InvalidAttributeValueLength
    case UnlikelyError
    case InsufficientEncryption
    case UnsupportedGroupType
    case InsufficientResources
}
Equatable, Hashable, RawRepresentable--
To
enum CBATTError : Int {
    case Success
    case InvalidHandle
    case ReadNotPermitted
    case WriteNotPermitted
    case InvalidPdu
    case InsufficientAuthentication
    case RequestNotSupported
    case InvalidOffset
    case InsufficientAuthorization
    case PrepareQueueFull
    case AttributeNotFound
    case AttributeNotLong
    case InsufficientEncryptionKeySize
    case InvalidAttributeValueLength
    case UnlikelyError
    case InsufficientEncryption
    case UnsupportedGroupType
    case InsufficientResources
}
extension CBATTError : Hashable, Equatable, __BridgedNSError, ErrorType, RawRepresentable, _ObjectiveCBridgeableErrorType, _BridgedNSError {
}
extension CBATTError : Hashable, Equatable, __BridgedNSError, ErrorType, RawRepresentable, _ObjectiveCBridgeableErrorType, _BridgedNSError {
}
Equatable, ErrorType, Hashable, RawRepresentableInt

Modified CBATTRequest
Declaration
From
class CBATTRequest : NSObject {
    var central: CBCentral! { get }
    var characteristic: CBCharacteristic! { get }
    var offset: Int { get }
    @NSCopying var value: NSData!
}
To
class CBATTRequest : NSObject {
    init()
    var central: CBCentral { get }
    var characteristic: CBCharacteristic { get }
    var offset: Int { get }
    @NSCopying var value: NSData?
}

Declaration
From
var central: CBCentral! { get }
To
var central: CBCentral { get }

Declaration
From
var characteristic: CBCharacteristic! { get }
To
var characteristic: CBCharacteristic { get }

Declaration
From
@NSCopying var value: NSData!
To
@NSCopying var value: NSData?

Modified CBAttribute
Declaration
From
class CBAttribute : NSObject {
    var UUID: CBUUID! { get }
}
To
class CBAttribute : NSObject {
    init()
    var UUID: CBUUID { get }
}

Declaration
From
var UUID: CBUUID! { get }
To
var UUID: CBUUID { get }

DeclarationProtocols
From
struct CBAttributePermissions : RawOptionSetType {
    init(_ rawValue: UInt)
    init(rawValue rawValue: UInt)
    static var Readable: CBAttributePermissions { get }
    static var Writeable: CBAttributePermissions { get }
    static var ReadEncryptionRequired: CBAttributePermissions { get }
    static var WriteEncryptionRequired: CBAttributePermissions { get }
}
RawOptionSetType
To
struct CBAttributePermissions : OptionSetType {
    init(rawValue rawValue: UInt)
    static var Readable: CBAttributePermissions { get }
    static var Writeable: CBAttributePermissions { get }
    static var ReadEncryptionRequired: CBAttributePermissions { get }
    static var WriteEncryptionRequired: CBAttributePermissions { get }
}
OptionSetType

Declaration
From
class CBCentralManager : NSObject {
    weak var delegate: CBCentralManagerDelegate!
    var state: CBCentralManagerState { get }
    convenience init!(delegate delegate: CBCentralManagerDelegate!, queue queue: dispatch_queue_t!)
    init!(delegate delegate: CBCentralManagerDelegate!, queue queue: dispatch_queue_t!, options options: [NSObject : AnyObject]!)
    func retrievePeripherals(_ peripheralUUIDs: [AnyObject]!)
    func retrievePeripheralsWithIdentifiers(_ identifiers: [AnyObject]!) -> [AnyObject]!
    func retrieveConnectedPeripherals()
    func retrieveConnectedPeripheralsWithServices(_ serviceUUIDs: [AnyObject]!) -> [AnyObject]!
    func scanForPeripheralsWithServices(_ serviceUUIDs: [AnyObject]!, options options: [NSObject : AnyObject]!)
    func stopScan()
    func connectPeripheral(_ peripheral: CBPeripheral!, options options: [NSObject : AnyObject]!)
    func cancelPeripheralConnection(_ peripheral: CBPeripheral!)
}
To
class CBCentralManager : NSObject {
    unowned(unsafe) var delegate: CBCentralManagerDelegate?
    var state: CBCentralManagerState { get }
    var isScanning: Bool { get }
    convenience init(delegate delegate: CBCentralManagerDelegate?, queue queue: dispatch_queue_t?)
    init(delegate delegate: CBCentralManagerDelegate?, queue queue: dispatch_queue_t?, options options: [String : AnyObject]?)
    func retrievePeripheralsWithIdentifiers(_ identifiers: [NSUUID]) -> [CBPeripheral]
    func retrieveConnectedPeripheralsWithServices(_ serviceUUIDs: [CBUUID]) -> [CBPeripheral]
    func scanForPeripheralsWithServices(_ serviceUUIDs: [CBUUID]?, options options: [String : AnyObject]?)
    func stopScan()
    func connectPeripheral(_ peripheral: CBPeripheral, options options: [String : AnyObject]?)
    func cancelPeripheralConnection(_ peripheral: CBPeripheral)
}

Declaration
From
func cancelPeripheralConnection(_ peripheral: CBPeripheral!)
To
func cancelPeripheralConnection(_ peripheral: CBPeripheral)

Declaration
From
func connectPeripheral(_ peripheral: CBPeripheral!, options options: [NSObject : AnyObject]!)
To
func connectPeripheral(_ peripheral: CBPeripheral, options options: [String : AnyObject]?)

Declaration
From
weak var delegate: CBCentralManagerDelegate!
To
unowned(unsafe) var delegate: CBCentralManagerDelegate?

Declaration
From
convenience init!(delegate delegate: CBCentralManagerDelegate!, queue queue: dispatch_queue_t!)
To
convenience init(delegate delegate: CBCentralManagerDelegate?, queue queue: dispatch_queue_t?)

Declaration
From
init!(delegate delegate: CBCentralManagerDelegate!, queue queue: dispatch_queue_t!, options options: [NSObject : AnyObject]!)
To
init(delegate delegate: CBCentralManagerDelegate?, queue queue: dispatch_queue_t?, options options: [String : AnyObject]?)

Declaration
From
func retrieveConnectedPeripheralsWithServices(_ serviceUUIDs: [AnyObject]!) -> [AnyObject]!
To
func retrieveConnectedPeripheralsWithServices(_ serviceUUIDs: [CBUUID]) -> [CBPeripheral]

Declaration
From
func retrievePeripheralsWithIdentifiers(_ identifiers: [AnyObject]!) -> [AnyObject]!
To
func retrievePeripheralsWithIdentifiers(_ identifiers: [NSUUID]) -> [CBPeripheral]

Declaration
From
func scanForPeripheralsWithServices(_ serviceUUIDs: [AnyObject]!, options options: [NSObject : AnyObject]!)
To
func scanForPeripheralsWithServices(_ serviceUUIDs: [CBUUID]?, options options: [String : AnyObject]?)

Declaration
From
protocol CBCentralManagerDelegate : NSObjectProtocol {
    func centralManagerDidUpdateState(_ central: CBCentralManager!)
    optional func centralManager(_ central: CBCentralManager!, willRestoreState dict: [NSObject : AnyObject]!)
    optional func centralManager(_ central: CBCentralManager!, didRetrievePeripherals peripherals: [AnyObject]!)
    optional func centralManager(_ central: CBCentralManager!, didRetrieveConnectedPeripherals peripherals: [AnyObject]!)
    optional func centralManager(_ central: CBCentralManager!, didDiscoverPeripheral peripheral: CBPeripheral!, advertisementData advertisementData: [NSObject : AnyObject]!, RSSI RSSI: NSNumber!)
    optional func centralManager(_ central: CBCentralManager!, didConnectPeripheral peripheral: CBPeripheral!)
    optional func centralManager(_ central: CBCentralManager!, didFailToConnectPeripheral peripheral: CBPeripheral!, error error: NSError!)
    optional func centralManager(_ central: CBCentralManager!, didDisconnectPeripheral peripheral: CBPeripheral!, error error: NSError!)
}
To
protocol CBCentralManagerDelegate : NSObjectProtocol {
    func centralManagerDidUpdateState(_ central: CBCentralManager)
    optional func centralManager(_ central: CBCentralManager, willRestoreState dict: [String : AnyObject])
    optional func centralManager(_ central: CBCentralManager, didDiscoverPeripheral peripheral: CBPeripheral, advertisementData advertisementData: [String : AnyObject], RSSI RSSI: NSNumber)
    optional func centralManager(_ central: CBCentralManager, didConnectPeripheral peripheral: CBPeripheral)
    optional func centralManager(_ central: CBCentralManager, didFailToConnectPeripheral peripheral: CBPeripheral, error error: NSError?)
    optional func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error error: NSError?)
}

DeclarationIntroduction
From
optional func centralManager(_ central: CBCentralManager!, didConnectPeripheral peripheral: CBPeripheral!)
iOS 8.0
To
optional func centralManager(_ central: CBCentralManager, didConnectPeripheral peripheral: CBPeripheral)
iOS 5.0

DeclarationIntroduction
From
optional func centralManager(_ central: CBCentralManager!, didDisconnectPeripheral peripheral: CBPeripheral!, error error: NSError!)
iOS 8.0
To
optional func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error error: NSError?)
iOS 5.0

DeclarationIntroduction
From
optional func centralManager(_ central: CBCentralManager!, didDiscoverPeripheral peripheral: CBPeripheral!, advertisementData advertisementData: [NSObject : AnyObject]!, RSSI RSSI: NSNumber!)
iOS 8.0
To
optional func centralManager(_ central: CBCentralManager, didDiscoverPeripheral peripheral: CBPeripheral, advertisementData advertisementData: [String : AnyObject], RSSI RSSI: NSNumber)
iOS 5.0

DeclarationIntroduction
From
optional func centralManager(_ central: CBCentralManager!, didFailToConnectPeripheral peripheral: CBPeripheral!, error error: NSError!)
iOS 8.0
To
optional func centralManager(_ central: CBCentralManager, didFailToConnectPeripheral peripheral: CBPeripheral, error error: NSError?)
iOS 5.0

DeclarationIntroduction
From
optional func centralManager(_ central: CBCentralManager!, willRestoreState dict: [NSObject : AnyObject]!)
iOS 8.0
To
optional func centralManager(_ central: CBCentralManager, willRestoreState dict: [String : AnyObject])
iOS 5.0

DeclarationIntroduction
From
func centralManagerDidUpdateState(_ central: CBCentralManager!)
iOS 8.0
To
func centralManagerDidUpdateState(_ central: CBCentralManager)
iOS 5.0

Raw Value Type
From--
ToInt

Declaration
From
class CBCharacteristic : CBAttribute {
    weak var service: CBService! { get }
    var properties: CBCharacteristicProperties { get }
    var value: NSData! { get }
    var descriptors: [AnyObject]! { get }
    var isBroadcasted: Bool { get }
    var isNotifying: Bool { get }
}
To
class CBCharacteristic : CBAttribute {
    unowned(unsafe) var service: CBService { get }
    var properties: CBCharacteristicProperties { get }
    var value: NSData? { get }
    var descriptors: [CBDescriptor]? { get }
    var isBroadcasted: Bool { get }
    var isNotifying: Bool { get }
}

Declaration
From
var descriptors: [AnyObject]! { get }
To
var descriptors: [CBDescriptor]? { get }

Declaration
From
weak var service: CBService! { get }
To
unowned(unsafe) var service: CBService { get }

Declaration
From
var value: NSData! { get }
To
var value: NSData? { get }

DeclarationProtocols
From
struct CBCharacteristicProperties : RawOptionSetType {
    init(_ rawValue: UInt)
    init(rawValue rawValue: UInt)
    static var Broadcast: CBCharacteristicProperties { get }
    static var Read: CBCharacteristicProperties { get }
    static var WriteWithoutResponse: CBCharacteristicProperties { get }
    static var Write: CBCharacteristicProperties { get }
    static var Notify: CBCharacteristicProperties { get }
    static var Indicate: CBCharacteristicProperties { get }
    static var AuthenticatedSignedWrites: CBCharacteristicProperties { get }
    static var ExtendedProperties: CBCharacteristicProperties { get }
    static var NotifyEncryptionRequired: CBCharacteristicProperties { get }
    static var IndicateEncryptionRequired: CBCharacteristicProperties { get }
}
RawOptionSetType
To
struct CBCharacteristicProperties : OptionSetType {
    init(rawValue rawValue: UInt)
    static var Broadcast: CBCharacteristicProperties { get }
    static var Read: CBCharacteristicProperties { get }
    static var WriteWithoutResponse: CBCharacteristicProperties { get }
    static var Write: CBCharacteristicProperties { get }
    static var Notify: CBCharacteristicProperties { get }
    static var Indicate: CBCharacteristicProperties { get }
    static var AuthenticatedSignedWrites: CBCharacteristicProperties { get }
    static var ExtendedProperties: CBCharacteristicProperties { get }
    static var NotifyEncryptionRequired: CBCharacteristicProperties { get }
    static var IndicateEncryptionRequired: CBCharacteristicProperties { get }
}
OptionSetType

Raw Value Type
From--
ToInt

Modified CBDescriptor
Declaration
From
class CBDescriptor : CBAttribute {
    weak var characteristic: CBCharacteristic! { get }
    var value: AnyObject! { get }
}
To
class CBDescriptor : CBAttribute {
    unowned(unsafe) var characteristic: CBCharacteristic { get }
    var value: AnyObject? { get }
}

Declaration
From
weak var characteristic: CBCharacteristic! { get }
To
unowned(unsafe) var characteristic: CBCharacteristic { get }

Declaration
From
var value: AnyObject! { get }
To
var value: AnyObject? { get }

DeclarationProtocolsRaw Value Type
From
enum CBError : Int {
    case Unknown
    case InvalidParameters
    case InvalidHandle
    case NotConnected
    case OutOfSpace
    case OperationCancelled
    case ConnectionTimeout
    case PeripheralDisconnected
    case UUIDNotAllowed
    case AlreadyAdvertising
    case ConnectionFailed
}
Equatable, Hashable, RawRepresentable--
To
enum CBError : Int {
    case Unknown
    case InvalidParameters
    case InvalidHandle
    case NotConnected
    case OutOfSpace
    case OperationCancelled
    case ConnectionTimeout
    case PeripheralDisconnected
    case UUIDNotAllowed
    case AlreadyAdvertising
    case ConnectionFailed
    case ConnectionLimitReached
}
extension CBError : Hashable, Equatable, __BridgedNSError, ErrorType, RawRepresentable, _ObjectiveCBridgeableErrorType, _BridgedNSError {
}
extension CBError : Hashable, Equatable, __BridgedNSError, ErrorType, RawRepresentable, _ObjectiveCBridgeableErrorType, _BridgedNSError {
}
Equatable, ErrorType, Hashable, RawRepresentableInt

Declaration
From
class CBMutableCharacteristic : CBCharacteristic {
    var permissions: CBAttributePermissions
    var subscribedCentrals: [AnyObject]! { get }
    var UUID: CBUUID!
    var properties: CBCharacteristicProperties
    var value: NSData!
    var descriptors: [AnyObject]!
    init!(type UUID: CBUUID!, properties properties: CBCharacteristicProperties, value value: NSData!, permissions permissions: CBAttributePermissions)
}
To
class CBMutableCharacteristic : CBCharacteristic {
    var permissions: CBAttributePermissions
    var subscribedCentrals: [CBCentral]? { get }
    var properties: CBCharacteristicProperties
    var value: NSData?
    var descriptors: [CBDescriptor]?
    init(type UUID: CBUUID, properties properties: CBCharacteristicProperties, value value: NSData?, permissions permissions: CBAttributePermissions)
}

Declaration
From
var descriptors: [AnyObject]!
To
var descriptors: [CBDescriptor]?

Declaration
From
init!(type UUID: CBUUID!, properties properties: CBCharacteristicProperties, value value: NSData!, permissions permissions: CBAttributePermissions)
To
init(type UUID: CBUUID, properties properties: CBCharacteristicProperties, value value: NSData?, permissions permissions: CBAttributePermissions)

Declaration
From
var subscribedCentrals: [AnyObject]! { get }
To
var subscribedCentrals: [CBCentral]? { get }

Declaration
From
var value: NSData!
To
var value: NSData?

Declaration
From
class CBMutableDescriptor : CBDescriptor {
    init!(type UUID: CBUUID!, value value: AnyObject!)
}
To
class CBMutableDescriptor : CBDescriptor {
    init(type UUID: CBUUID, value value: AnyObject?)
}

Declaration
From
init!(type UUID: CBUUID!, value value: AnyObject!)
To
init(type UUID: CBUUID, value value: AnyObject?)

Declaration
From
class CBMutableService : CBService {
    var UUID: CBUUID!
    var isPrimary: Bool
    var includedServices: [AnyObject]!
    var characteristics: [AnyObject]!
    init!(type UUID: CBUUID!, primary isPrimary: Bool)
}
To
class CBMutableService : CBService {
    var includedServices: [CBService]?
    var characteristics: [CBCharacteristic]?
    init(type UUID: CBUUID, primary isPrimary: Bool)
}

Declaration
From
var characteristics: [AnyObject]!
To
var characteristics: [CBCharacteristic]?

Declaration
From
var includedServices: [AnyObject]!
To
var includedServices: [CBService]?

Declaration
From
init!(type UUID: CBUUID!, primary isPrimary: Bool)
To
init(type UUID: CBUUID, primary isPrimary: Bool)

Modified CBPeer
Declaration
From
class CBPeer : NSObject, NSCopying {
    var UUID: CFUUID! { get }
    var identifier: NSUUID! { get }
}
To
class CBPeer : NSObject, NSCopying {
    init()
    var identifier: NSUUID { get }
}

Declaration
From
var identifier: NSUUID! { get }
To
var identifier: NSUUID { get }

Modified CBPeripheral
Declaration
From
class CBPeripheral : CBPeer {
    weak var delegate: CBPeripheralDelegate!
    var name: String! { get }
    var RSSI: NSNumber! { get }
    var isConnected: Bool { get }
    var state: CBPeripheralState { get }
    var services: [AnyObject]! { get }
    func readRSSI()
    func discoverServices(_ serviceUUIDs: [AnyObject]!)
    func discoverIncludedServices(_ includedServiceUUIDs: [AnyObject]!, forService service: CBService!)
    func discoverCharacteristics(_ characteristicUUIDs: [AnyObject]!, forService service: CBService!)
    func readValueForCharacteristic(_ characteristic: CBCharacteristic!)
    func writeValue(_ data: NSData!, forCharacteristic characteristic: CBCharacteristic!, type type: CBCharacteristicWriteType)
    func setNotifyValue(_ enabled: Bool, forCharacteristic characteristic: CBCharacteristic!)
    func discoverDescriptorsForCharacteristic(_ characteristic: CBCharacteristic!)
    func readValueForDescriptor(_ descriptor: CBDescriptor!)
    func writeValue(_ data: NSData!, forDescriptor descriptor: CBDescriptor!)
}
To
class CBPeripheral : CBPeer {
    unowned(unsafe) var delegate: CBPeripheralDelegate?
    var name: String? { get }
    var RSSI: NSNumber? { get }
    var state: CBPeripheralState { get }
    var services: [CBService]? { get }
    func readRSSI()
    func discoverServices(_ serviceUUIDs: [CBUUID]?)
    func discoverIncludedServices(_ includedServiceUUIDs: [CBUUID]?, forService service: CBService)
    func discoverCharacteristics(_ characteristicUUIDs: [CBUUID]?, forService service: CBService)
    func readValueForCharacteristic(_ characteristic: CBCharacteristic)
    func maximumWriteValueLengthForType(_ type: CBCharacteristicWriteType) -> Int
    func writeValue(_ data: NSData, forCharacteristic characteristic: CBCharacteristic, type type: CBCharacteristicWriteType)
    func setNotifyValue(_ enabled: Bool, forCharacteristic characteristic: CBCharacteristic)
    func discoverDescriptorsForCharacteristic(_ characteristic: CBCharacteristic)
    func readValueForDescriptor(_ descriptor: CBDescriptor)
    func writeValue(_ data: NSData, forDescriptor descriptor: CBDescriptor)
}

Declaration
From
weak var delegate: CBPeripheralDelegate!
To
unowned(unsafe) var delegate: CBPeripheralDelegate?

Declaration
From
func discoverCharacteristics(_ characteristicUUIDs: [AnyObject]!, forService service: CBService!)
To
func discoverCharacteristics(_ characteristicUUIDs: [CBUUID]?, forService service: CBService)

Declaration
From
func discoverDescriptorsForCharacteristic(_ characteristic: CBCharacteristic!)
To
func discoverDescriptorsForCharacteristic(_ characteristic: CBCharacteristic)

Declaration
From
func discoverIncludedServices(_ includedServiceUUIDs: [AnyObject]!, forService service: CBService!)
To
func discoverIncludedServices(_ includedServiceUUIDs: [CBUUID]?, forService service: CBService)

Declaration
From
func discoverServices(_ serviceUUIDs: [AnyObject]!)
To
func discoverServices(_ serviceUUIDs: [CBUUID]?)

Declaration
From
var name: String! { get }
To
var name: String? { get }

Declaration
From
func readValueForCharacteristic(_ characteristic: CBCharacteristic!)
To
func readValueForCharacteristic(_ characteristic: CBCharacteristic)

Declaration
From
func readValueForDescriptor(_ descriptor: CBDescriptor!)
To
func readValueForDescriptor(_ descriptor: CBDescriptor)

Declaration
From
var RSSI: NSNumber! { get }
To
var RSSI: NSNumber? { get }

Declaration
From
var services: [AnyObject]! { get }
To
var services: [CBService]? { get }

Declaration
From
func setNotifyValue(_ enabled: Bool, forCharacteristic characteristic: CBCharacteristic!)
To
func setNotifyValue(_ enabled: Bool, forCharacteristic characteristic: CBCharacteristic)

Declaration
From
func writeValue(_ data: NSData!, forCharacteristic characteristic: CBCharacteristic!, type type: CBCharacteristicWriteType)
To
func writeValue(_ data: NSData, forCharacteristic characteristic: CBCharacteristic, type type: CBCharacteristicWriteType)

Declaration
From
func writeValue(_ data: NSData!, forDescriptor descriptor: CBDescriptor!)
To
func writeValue(_ data: NSData, forDescriptor descriptor: CBDescriptor)

Declaration
From
protocol CBPeripheralDelegate : NSObjectProtocol {
    optional func peripheralDidUpdateName(_ peripheral: CBPeripheral!)
    optional func peripheralDidInvalidateServices(_ peripheral: CBPeripheral!)
    optional func peripheral(_ peripheral: CBPeripheral!, didModifyServices invalidatedServices: [AnyObject]!)
    optional func peripheralDidUpdateRSSI(_ peripheral: CBPeripheral!, error error: NSError!)
    optional func peripheral(_ peripheral: CBPeripheral!, didReadRSSI RSSI: NSNumber!, error error: NSError!)
    optional func peripheral(_ peripheral: CBPeripheral!, didDiscoverServices error: NSError!)
    optional func peripheral(_ peripheral: CBPeripheral!, didDiscoverIncludedServicesForService service: CBService!, error error: NSError!)
    optional func peripheral(_ peripheral: CBPeripheral!, didDiscoverCharacteristicsForService service: CBService!, error error: NSError!)
    optional func peripheral(_ peripheral: CBPeripheral!, didUpdateValueForCharacteristic characteristic: CBCharacteristic!, error error: NSError!)
    optional func peripheral(_ peripheral: CBPeripheral!, didWriteValueForCharacteristic characteristic: CBCharacteristic!, error error: NSError!)
    optional func peripheral(_ peripheral: CBPeripheral!, didUpdateNotificationStateForCharacteristic characteristic: CBCharacteristic!, error error: NSError!)
    optional func peripheral(_ peripheral: CBPeripheral!, didDiscoverDescriptorsForCharacteristic characteristic: CBCharacteristic!, error error: NSError!)
    optional func peripheral(_ peripheral: CBPeripheral!, didUpdateValueForDescriptor descriptor: CBDescriptor!, error error: NSError!)
    optional func peripheral(_ peripheral: CBPeripheral!, didWriteValueForDescriptor descriptor: CBDescriptor!, error error: NSError!)
}
To
protocol CBPeripheralDelegate : NSObjectProtocol {
    optional func peripheralDidUpdateName(_ peripheral: CBPeripheral)
    optional func peripheral(_ peripheral: CBPeripheral, didModifyServices invalidatedServices: [CBService])
    optional func peripheralDidUpdateRSSI(_ peripheral: CBPeripheral, error error: NSError?)
    optional func peripheral(_ peripheral: CBPeripheral, didReadRSSI RSSI: NSNumber, error error: NSError?)
    optional func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: NSError?)
    optional func peripheral(_ peripheral: CBPeripheral, didDiscoverIncludedServicesForService service: CBService, error error: NSError?)
    optional func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsForService service: CBService, error error: NSError?)
    optional func peripheral(_ peripheral: CBPeripheral, didUpdateValueForCharacteristic characteristic: CBCharacteristic, error error: NSError?)
    optional func peripheral(_ peripheral: CBPeripheral, didWriteValueForCharacteristic characteristic: CBCharacteristic, error error: NSError?)
    optional func peripheral(_ peripheral: CBPeripheral, didUpdateNotificationStateForCharacteristic characteristic: CBCharacteristic, error error: NSError?)
    optional func peripheral(_ peripheral: CBPeripheral, didDiscoverDescriptorsForCharacteristic characteristic: CBCharacteristic, error error: NSError?)
    optional func peripheral(_ peripheral: CBPeripheral, didUpdateValueForDescriptor descriptor: CBDescriptor, error error: NSError?)
    optional func peripheral(_ peripheral: CBPeripheral, didWriteValueForDescriptor descriptor: CBDescriptor, error error: NSError?)
}

DeclarationIntroduction
From
optional func peripheral(_ peripheral: CBPeripheral!, didDiscoverCharacteristicsForService service: CBService!, error error: NSError!)
iOS 8.0
To
optional func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsForService service: CBService, error error: NSError?)
iOS 5.0

DeclarationIntroduction
From
optional func peripheral(_ peripheral: CBPeripheral!, didDiscoverDescriptorsForCharacteristic characteristic: CBCharacteristic!, error error: NSError!)
iOS 8.0
To
optional func peripheral(_ peripheral: CBPeripheral, didDiscoverDescriptorsForCharacteristic characteristic: CBCharacteristic, error error: NSError?)
iOS 5.0

DeclarationIntroduction
From
optional func peripheral(_ peripheral: CBPeripheral!, didDiscoverIncludedServicesForService service: CBService!, error error: NSError!)
iOS 8.0
To
optional func peripheral(_ peripheral: CBPeripheral, didDiscoverIncludedServicesForService service: CBService, error error: NSError?)
iOS 5.0

DeclarationIntroduction
From
optional func peripheral(_ peripheral: CBPeripheral!, didDiscoverServices error: NSError!)
iOS 8.0
To
optional func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: NSError?)
iOS 5.0

Declaration
From
optional func peripheral(_ peripheral: CBPeripheral!, didModifyServices invalidatedServices: [AnyObject]!)
To
optional func peripheral(_ peripheral: CBPeripheral, didModifyServices invalidatedServices: [CBService])

Declaration
From
optional func peripheral(_ peripheral: CBPeripheral!, didReadRSSI RSSI: NSNumber!, error error: NSError!)
To
optional func peripheral(_ peripheral: CBPeripheral, didReadRSSI RSSI: NSNumber, error error: NSError?)

DeclarationIntroduction
From
optional func peripheral(_ peripheral: CBPeripheral!, didUpdateNotificationStateForCharacteristic characteristic: CBCharacteristic!, error error: NSError!)
iOS 8.0
To
optional func peripheral(_ peripheral: CBPeripheral, didUpdateNotificationStateForCharacteristic characteristic: CBCharacteristic, error error: NSError?)
iOS 5.0

DeclarationIntroduction
From
optional func peripheral(_ peripheral: CBPeripheral!, didUpdateValueForCharacteristic characteristic: CBCharacteristic!, error error: NSError!)
iOS 8.0
To
optional func peripheral(_ peripheral: CBPeripheral, didUpdateValueForCharacteristic characteristic: CBCharacteristic, error error: NSError?)
iOS 5.0

DeclarationIntroduction
From
optional func peripheral(_ peripheral: CBPeripheral!, didUpdateValueForDescriptor descriptor: CBDescriptor!, error error: NSError!)
iOS 8.0
To
optional func peripheral(_ peripheral: CBPeripheral, didUpdateValueForDescriptor descriptor: CBDescriptor, error error: NSError?)
iOS 5.0

DeclarationIntroduction
From
optional func peripheral(_ peripheral: CBPeripheral!, didWriteValueForCharacteristic characteristic: CBCharacteristic!, error error: NSError!)
iOS 8.0
To
optional func peripheral(_ peripheral: CBPeripheral, didWriteValueForCharacteristic characteristic: CBCharacteristic, error error: NSError?)
iOS 5.0

DeclarationIntroduction
From
optional func peripheral(_ peripheral: CBPeripheral!, didWriteValueForDescriptor descriptor: CBDescriptor!, error error: NSError!)
iOS 8.0
To
optional func peripheral(_ peripheral: CBPeripheral, didWriteValueForDescriptor descriptor: CBDescriptor, error error: NSError?)
iOS 5.0

Declaration
From
optional func peripheralDidUpdateName(_ peripheral: CBPeripheral!)
To
optional func peripheralDidUpdateName(_ peripheral: CBPeripheral)

Declaration
From
optional func peripheralDidUpdateRSSI(_ peripheral: CBPeripheral!, error error: NSError!)
To
optional func peripheralDidUpdateRSSI(_ peripheral: CBPeripheral, error error: NSError?)

Declaration
From
class CBPeripheralManager : NSObject {
    weak var delegate: CBPeripheralManagerDelegate!
    var state: CBPeripheralManagerState { get }
    var isAdvertising: Bool { get }
    class func authorizationStatus() -> CBPeripheralManagerAuthorizationStatus
    convenience init!(delegate delegate: CBPeripheralManagerDelegate!, queue queue: dispatch_queue_t!)
    init!(delegate delegate: CBPeripheralManagerDelegate!, queue queue: dispatch_queue_t!, options options: [NSObject : AnyObject]!)
    func startAdvertising(_ advertisementData: [NSObject : AnyObject]!)
    func stopAdvertising()
    func setDesiredConnectionLatency(_ latency: CBPeripheralManagerConnectionLatency, forCentral central: CBCentral!)
    func addService(_ service: CBMutableService!)
    func removeService(_ service: CBMutableService!)
    func removeAllServices()
    func respondToRequest(_ request: CBATTRequest!, withResult result: CBATTError)
    func updateValue(_ value: NSData!, forCharacteristic characteristic: CBMutableCharacteristic!, onSubscribedCentrals centrals: [AnyObject]!) -> Bool
}
To
class CBPeripheralManager : NSObject {
    unowned(unsafe) var delegate: CBPeripheralManagerDelegate?
    var state: CBPeripheralManagerState { get }
    var isAdvertising: Bool { get }
    class func authorizationStatus() -> CBPeripheralManagerAuthorizationStatus
    convenience init(delegate delegate: CBPeripheralManagerDelegate?, queue queue: dispatch_queue_t?)
    init(delegate delegate: CBPeripheralManagerDelegate?, queue queue: dispatch_queue_t?, options options: [String : AnyObject]?)
    func startAdvertising(_ advertisementData: [String : AnyObject]?)
    func stopAdvertising()
    func setDesiredConnectionLatency(_ latency: CBPeripheralManagerConnectionLatency, forCentral central: CBCentral)
    func addService(_ service: CBMutableService)
    func removeService(_ service: CBMutableService)
    func removeAllServices()
    func respondToRequest(_ request: CBATTRequest, withResult result: CBATTError)
    func updateValue(_ value: NSData, forCharacteristic characteristic: CBMutableCharacteristic, onSubscribedCentrals centrals: [CBCentral]?) -> Bool
}

Declaration
From
func addService(_ service: CBMutableService!)
To
func addService(_ service: CBMutableService)

Declaration
From
weak var delegate: CBPeripheralManagerDelegate!
To
unowned(unsafe) var delegate: CBPeripheralManagerDelegate?

Declaration
From
convenience init!(delegate delegate: CBPeripheralManagerDelegate!, queue queue: dispatch_queue_t!)
To
convenience init(delegate delegate: CBPeripheralManagerDelegate?, queue queue: dispatch_queue_t?)

Declaration
From
init!(delegate delegate: CBPeripheralManagerDelegate!, queue queue: dispatch_queue_t!, options options: [NSObject : AnyObject]!)
To
init(delegate delegate: CBPeripheralManagerDelegate?, queue queue: dispatch_queue_t?, options options: [String : AnyObject]?)

Declaration
From
func removeService(_ service: CBMutableService!)
To
func removeService(_ service: CBMutableService)

Declaration
From
func respondToRequest(_ request: CBATTRequest!, withResult result: CBATTError)
To
func respondToRequest(_ request: CBATTRequest, withResult result: CBATTError)

Declaration
From
func setDesiredConnectionLatency(_ latency: CBPeripheralManagerConnectionLatency, forCentral central: CBCentral!)
To
func setDesiredConnectionLatency(_ latency: CBPeripheralManagerConnectionLatency, forCentral central: CBCentral)

Declaration
From
func startAdvertising(_ advertisementData: [NSObject : AnyObject]!)
To
func startAdvertising(_ advertisementData: [String : AnyObject]?)

Declaration
From
func updateValue(_ value: NSData!, forCharacteristic characteristic: CBMutableCharacteristic!, onSubscribedCentrals centrals: [AnyObject]!) -> Bool
To
func updateValue(_ value: NSData, forCharacteristic characteristic: CBMutableCharacteristic, onSubscribedCentrals centrals: [CBCentral]?) -> Bool

Raw Value Type
From--
ToInt

Raw Value Type
From--
ToInt

Declaration
From
protocol CBPeripheralManagerDelegate : NSObjectProtocol {
    func peripheralManagerDidUpdateState(_ peripheral: CBPeripheralManager!)
    optional func peripheralManager(_ peripheral: CBPeripheralManager!, willRestoreState dict: [NSObject : AnyObject]!)
    optional func peripheralManagerDidStartAdvertising(_ peripheral: CBPeripheralManager!, error error: NSError!)
    optional func peripheralManager(_ peripheral: CBPeripheralManager!, didAddService service: CBService!, error error: NSError!)
    optional func peripheralManager(_ peripheral: CBPeripheralManager!, central central: CBCentral!, didSubscribeToCharacteristic characteristic: CBCharacteristic!)
    optional func peripheralManager(_ peripheral: CBPeripheralManager!, central central: CBCentral!, didUnsubscribeFromCharacteristic characteristic: CBCharacteristic!)
    optional func peripheralManager(_ peripheral: CBPeripheralManager!, didReceiveReadRequest request: CBATTRequest!)
    optional func peripheralManager(_ peripheral: CBPeripheralManager!, didReceiveWriteRequests requests: [AnyObject]!)
    optional func peripheralManagerIsReadyToUpdateSubscribers(_ peripheral: CBPeripheralManager!)
}
To
protocol CBPeripheralManagerDelegate : NSObjectProtocol {
    func peripheralManagerDidUpdateState(_ peripheral: CBPeripheralManager)
    optional func peripheralManager(_ peripheral: CBPeripheralManager, willRestoreState dict: [String : AnyObject])
    optional func peripheralManagerDidStartAdvertising(_ peripheral: CBPeripheralManager, error error: NSError?)
    optional func peripheralManager(_ peripheral: CBPeripheralManager, didAddService service: CBService, error error: NSError?)
    optional func peripheralManager(_ peripheral: CBPeripheralManager, central central: CBCentral, didSubscribeToCharacteristic characteristic: CBCharacteristic)
    optional func peripheralManager(_ peripheral: CBPeripheralManager, central central: CBCentral, didUnsubscribeFromCharacteristic characteristic: CBCharacteristic)
    optional func peripheralManager(_ peripheral: CBPeripheralManager, didReceiveReadRequest request: CBATTRequest)
    optional func peripheralManager(_ peripheral: CBPeripheralManager, didReceiveWriteRequests requests: [CBATTRequest])
    optional func peripheralManagerIsReadyToUpdateSubscribers(_ peripheral: CBPeripheralManager)
}

DeclarationIntroduction
From
optional func peripheralManager(_ peripheral: CBPeripheralManager!, central central: CBCentral!, didSubscribeToCharacteristic characteristic: CBCharacteristic!)
iOS 8.0
To
optional func peripheralManager(_ peripheral: CBPeripheralManager, central central: CBCentral, didSubscribeToCharacteristic characteristic: CBCharacteristic)
iOS 6.0

DeclarationIntroduction
From
optional func peripheralManager(_ peripheral: CBPeripheralManager!, central central: CBCentral!, didUnsubscribeFromCharacteristic characteristic: CBCharacteristic!)
iOS 8.0
To
optional func peripheralManager(_ peripheral: CBPeripheralManager, central central: CBCentral, didUnsubscribeFromCharacteristic characteristic: CBCharacteristic)
iOS 6.0

DeclarationIntroduction
From
optional func peripheralManager(_ peripheral: CBPeripheralManager!, didAddService service: CBService!, error error: NSError!)
iOS 8.0
To
optional func peripheralManager(_ peripheral: CBPeripheralManager, didAddService service: CBService, error error: NSError?)
iOS 6.0

DeclarationIntroduction
From
optional func peripheralManager(_ peripheral: CBPeripheralManager!, didReceiveReadRequest request: CBATTRequest!)
iOS 8.0
To
optional func peripheralManager(_ peripheral: CBPeripheralManager, didReceiveReadRequest request: CBATTRequest)
iOS 6.0

DeclarationIntroduction
From
optional func peripheralManager(_ peripheral: CBPeripheralManager!, didReceiveWriteRequests requests: [AnyObject]!)
iOS 8.0
To
optional func peripheralManager(_ peripheral: CBPeripheralManager, didReceiveWriteRequests requests: [CBATTRequest])
iOS 6.0

DeclarationIntroduction
From
optional func peripheralManager(_ peripheral: CBPeripheralManager!, willRestoreState dict: [NSObject : AnyObject]!)
iOS 8.0
To
optional func peripheralManager(_ peripheral: CBPeripheralManager, willRestoreState dict: [String : AnyObject])
iOS 6.0

DeclarationIntroduction
From
optional func peripheralManagerDidStartAdvertising(_ peripheral: CBPeripheralManager!, error error: NSError!)
iOS 8.0
To
optional func peripheralManagerDidStartAdvertising(_ peripheral: CBPeripheralManager, error error: NSError?)
iOS 6.0

DeclarationIntroduction
From
func peripheralManagerDidUpdateState(_ peripheral: CBPeripheralManager!)
iOS 8.0
To
func peripheralManagerDidUpdateState(_ peripheral: CBPeripheralManager)
iOS 6.0

DeclarationIntroduction
From
optional func peripheralManagerIsReadyToUpdateSubscribers(_ peripheral: CBPeripheralManager!)
iOS 8.0
To
optional func peripheralManagerIsReadyToUpdateSubscribers(_ peripheral: CBPeripheralManager)
iOS 6.0

Raw Value Type
From--
ToInt

DeclarationRaw Value Type
From
enum CBPeripheralState : Int {
    case Disconnected
    case Connecting
    case Connected
}
--
To
enum CBPeripheralState : Int {
    case Disconnected
    case Connecting
    case Connected
    case Disconnecting
}
Int

Modified CBService
Declaration
From
class CBService : CBAttribute {
    weak var peripheral: CBPeripheral! { get }
    var isPrimary: Bool { get }
    var includedServices: [AnyObject]! { get }
    var characteristics: [AnyObject]! { get }
}
To
class CBService : CBAttribute {
    unowned(unsafe) var peripheral: CBPeripheral { get }
    var isPrimary: Bool { get }
    var includedServices: [CBService]? { get }
    var characteristics: [CBCharacteristic]? { get }
}

Declaration
From
var characteristics: [AnyObject]! { get }
To
var characteristics: [CBCharacteristic]? { get }

Declaration
From
var includedServices: [AnyObject]! { get }
To
var includedServices: [CBService]? { get }

Declaration
From
weak var peripheral: CBPeripheral! { get }
To
unowned(unsafe) var peripheral: CBPeripheral { get }

Modified CBUUID
Declaration
From
class CBUUID : NSObject, NSCopying {
    var data: NSData! { get }
    var UUIDString: String! { get }
    init!(string theString: String!) -> CBUUID
    class func UUIDWithString(_ theString: String!) -> CBUUID!
    init!(data theData: NSData!) -> CBUUID
    class func UUIDWithData(_ theData: NSData!) -> CBUUID!
    init!(CFUUID theUUID: CFUUID!) -> CBUUID
    class func UUIDWithCFUUID(_ theUUID: CFUUID!) -> CBUUID!
    init!(NSUUID theUUID: NSUUID!) -> CBUUID
    class func UUIDWithNSUUID(_ theUUID: NSUUID!) -> CBUUID!
}
To
class CBUUID : NSObject, NSCopying {
    var data: NSData { get }
    var UUIDString: String { get }
     init(string theString: String)
    class func UUIDWithString(_ theString: String) -> CBUUID
     init(data theData: NSData)
    class func UUIDWithData(_ theData: NSData) -> CBUUID
     init(CFUUID theUUID: CFUUID)
    class func UUIDWithCFUUID(_ theUUID: CFUUID) -> CBUUID
     init(NSUUID theUUID: NSUUID)
    class func UUIDWithNSUUID(_ theUUID: NSUUID) -> CBUUID
}

Modified CBUUID.data
Declaration
From
var data: NSData! { get }
To
var data: NSData { get }

DeclarationIntroductionDeprecation
From
init!(CFUUID theUUID: CFUUID!) -> CBUUID
iOS 8.1--
To
init(CFUUID theUUID: CFUUID)
iOS 5.0iOS 9.0

Declaration
From
init!(data theData: NSData!) -> CBUUID
To
init(data theData: NSData)

Declaration
From
init!(NSUUID theUUID: NSUUID!) -> CBUUID
To
init(NSUUID theUUID: NSUUID)

Declaration
From
init!(string theString: String!) -> CBUUID
To
init(string theString: String)

Declaration
From
var UUIDString: String! { get }
To
var UUIDString: String { get }