Swiftpack.co -  robkerr/esp-idf-swift as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
robkerr/esp-idf-swift
Main components for Swift ESP-IDF
.package(url: "https://github.com/robkerr/esp-idf-swift.git", from: "0.1.7")

esp-idf-swift

This repository is a restructure of the ESP-IDF code into a repository that supports Swift Package Manager, while maintaining support for CocoaPods. This is meant as a reference implementation for adding SPM support to the main ESP-IDF library.

To support both package managers, the Objective-C modules are refactored into their own repository: esp-idf-objc

This is done because for Swift Package Manager, the Objective-C module is its own target, and thus its own module. If the Objective-C code is its own module, then for CocoaPods it needs to be its own Pod, which implies its own git repo/podspec.

In total the following structure changes were implemented as part of this refactor:

  • .m and .h modules moved to esp-idf-objc
  • source code relocated below Sources folder (SPM expectation)
  • for esp-idf-objc, the module name CESPProvision was used (suggested as convention by swift package manager docs)
  • for esp-idf-objc, the umbrella .h file renamed CESPProvision.h, and located in Sources/include folder (per SPM spec)
  • In the esp-idf-swift moduoe, added "Import CESPProvision" to the following files: CryptoAES.swift, ESPExtensions.swift, ESPDevice.swift. This is needed since the C functions are in their own module.
  • .podspec for esp-idf-swift is modified slightly to point to the Sources folder for .swift files
  • .podspec for esp-idf-swift adds a dependency to esp-idf-objc
  • .podspec for esp-idf-objc created
  • Package.swift created for both esp-idf-objc and esp-idf-swift.

The resulting experience for developers:

  • CocoaPod users would integreate the library as before, by adding pod ESPProvision to their Podfile
  • Swift Package Manager users would add the Swift Package from within Xcode using the .git url, e.g. https://github.com/robkerr/esp-idf-swift
  • For both CocoaPods and SPM, the dependent C module will be imported automatically.

GitHub

link
Stars: 0
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API