ESPTouch with iOS (Swift)
Integrate the Wi-Fi module config with your existing iOS project
ESP8266 chips have a handy little feature that allows you to configure WiFi credentials that they use without actually connecting to them.
One of the protocols it supports is called ESP Touch and to get it working under the Xcode IDE you can use the code below as a starting point.
Espressif’s ESP-TOUCH protocol implements the Smart Config technology to help users connect ESP8266EX-embedded devices to a Wi-Fi network through simple configuration on a smartphone. — ESPTouch website
Official application available on app store : https://apps.apple.com/us/app/espressif-esptouch/id1071176700
Steps to follow :
- Copy esptouch source code from official GitHub repo
https://github.com/EspressifApp/EsptouchForIOS
This code is available in Objective-C version. So we need to create a bridge for Objective-C to Swift. - Create Bridging header
https://developer.apple.com/documentation/swift/migrating_your_objective-c_code_to_swift
https://stackoverflow.com/questions/24002369/how-to-call-objective-c-code-from-swift - Copy files from ESPTouch project to the main project
You should copy a few supporting files from ESPTouch project cloned directory to your main swift project. Simple drag & drop works. If it is ambiguous for you, follow this link
https://stackoverflow.com/questions/6821057/xcode-how-could-you-copy-paste-classes-files-from-one-project-into-another - Adding lib file to your project
- Granting Wi-Fi privileges to your main project
Before proceeding to integrate with our main project, we need to make sure we grant Wi-Fi permission from developer.apple.com
> You should enable it in apple’s developer portal.
> Go to “App IDs” and edit your app.
> Check theWireless Accessory Configuration
checkbox.
> ClickDone
Now just regenerate your provisioning profile and rebuild/archive using newly generated profile.