Welcome to the herald documentation
Here you will find all the necessary information to get started with herald – a powerful and flexible library for iOS. Herald allows you to easily integrate Bluetooth Low Energy (BLE) functionality into your iOS apps.
Key Features
- Efficiently handle Bluetooth Low Energy (BLE) communication
- Build and manage connections to BLE peripherals
- Discover and track nearby BLE peripherals
- Send and receive data over BLE
- Implement background mode support for BLE operations
- Supports a wide range of BLE peripherals and services
Installation
To begin using herald in your iOS project, follow the steps below:
- Add the following line to your Podfile: pod 'Herald' - Run `pod install` from your terminal
Usage
Once you have installed herald, you can start integrating it into your iOS app. Follow the steps below to get started:
- Import the herald framework in your Swift file:
import Herald
The above line of code allows you to access all the classes and functionalities provided by the herald framework.
Example
Here’s an example of how to discover nearby BLE peripherals using herald:
// Create a Herald detector to start scanning for nearby peripherals let detector = Herald.ble() detector.addListener(self) class MyHeraldListener: BLESensorDelegate { func sensor(_ sensor: SensorType, didDetect: TargetIdentifier) { // Perform actions when a new peripheral is detected } func sensor(_ sensor: SensorType, didMeasure: Proximity, fromTarget: TargetIdentifier) { // Perform actions based on the signal strength of the detected peripheral } } // Implement the required delegate methods to handle the detected peripherals and signal strength measurements
Troubleshooting
- Issue: Unable to detect any BLE peripherals
- Solution: Make sure that your iOS device’s Bluetooth is turned on and the peripheral is discoverable.
- Issue: Encountering errors during installation or integration
- Solution: Ensure that you have followed the installation steps correctly and that your project is properly configured.
- Issue: Unexpected behavior or crashes
- Solution: Review your implementation, check for any inconsistencies or conflicts with other libraries or frameworks you may be using.
Conclusion
With herald, you can now easily add Bluetooth Low Energy (BLE) functionality to your iOS app. Take advantage of the powerful features provided by herald to efficiently handle BLE communication, build connections to peripherals, and exchange data seamlessly.