To save CBPeripheral object in CoreData, you need to follow some steps:
Transformable. This attribute will hold the CBPeripheral object.CBPeripheral object to NSData.NSData object to the Transformable attribute of the CoreData entity.Here's the code to achieve this:
main.swift692 chars16 linesTo fetch and use the CBPeripheral object from CoreData, you need to reverse the steps:
NSData object from the CoreData entity's attribute.NSKeyedUnarchiver to convert NSData to CBPeripheral.Here's the code to achieve this:
main.swift390 chars10 linesNote:
CoreData and CoreBluetooth frameworks.CBPeripheral object. It does not save the connection or pairing status.gistlibby LogSnag