CocoaPods served us very well for long years. It is an absolutely great package manager that is both convenient and robust enough to support very complex build pipelines that go well beyond regular iOS/macOS/tvOS development (like OpenCV2 C++ library, etc). It is so robust that it took Swift Package Manager more than 3 years to fill the gap between the two. Finally, with Xcode 12 and Swift 5.3 toolchain we are receiving long-awaited support for resources, binary packages and robust build settings for SwiftPM. Those additions are going to become major enablers for folks to convert their Pods into Packages.
SwiftPM is also going to bring a lot of neat things like static linkage by default and dedicated bundles for framework resources, so one should definitely consider migrating from CocoaPods to SwiftPM as it can make your app faster, smaller and also provide some nice code-generated things in your code, like
In this article we are going to quickly cover a trivial GitHub Actions setup I use for my open source Metal library Alloy to automatically publish new versions into CocoaPods trunk register.
First, we will need to grab a registration token from CocoaPods. You can get it by using the
pod trunk register command.
pod trunk register email@example.com -- description "GitHub Actions Token"
You will receive an e-mail with a confirmation link to confirm you are the owner of that e-mail. Once you’ve confirmed the token you can obtain it from private files using the following command:
grep -A2 'trunk.cocoapods.org' ~/.netrc …
Metal API is great, it opens up a whole lot of possibilities on both mobile and desktop devices. However, GPUs can be sometimes a bit clumsy, especially in high-precision things like font rendering or curve drawing, so sometimes you really miss good old CPU things. It happens to me pretty often that I would love to use some tiny bits of CoreGraphics functionality, but keep my GPU pipelines fast and efficient, with absence of redundant conversions or CPU/GPU synchronization breaks.
The case that inspired me to write this article was to give users the ability to draw a mask overlay in order to identify zones where they want certain effects to appear. It is of course possible to implement drawing with Metal, but that will require a lot of work: keeping a path data, triangulation and rendering logic. For quick prototype it is much easier to just use CoreGraphics, however the most straightforward approach is to create a CGImage from UI canvas and then convert to a MTLTexture to feed it as a mask to some shaders. …