This is a Swift Package containing Swift code and Utilities/Assets, such as Colors, used by Nordic's iOS/Mac apps.
Important
This repository contains APIs and Utilities used by ourselves. Ones that we find useful to extend to the community, because most of it we've learned through you, so we owe it back to you. That being said, this repository should not be considered public-facing API. We reserve the right to modify any of the components shared here to fit our uses.
The swatch of Nordic colors is available here for our own use. We're keeping to the DRY Principle of course, but the side-benefit of this is that updating the colors in one place, automagically updates all of our apps.
Additionally, there are helper items here. We have struct RGB
and RGBA
structures so that 8-bit colors can be stored as a UInt32
and thus helping memory consumption.
Cache
: Need to useNSCache
with a pure-Swiftstruct
? This is what this is for. Also, it's just John Sundell's work in a library that we use.BitField
: Alternative to anenum
Set
that allows us to store everything in a single CPU Register, both in memory and as aCodable
.NordicLog
: Apple addedOSLog
as the performance-oriented logging API for their platforms back in 2018. We've since adopted it in nRF Connect for Mobile, and extended its use accross all apps. And what we found is that, we kept re-implementing the same set of APIs for logging everywhere. So we picked one implementation, and moved it here so that we can use it everywhere. Additionally, it supports not only OSLog APIs but also performance-logging APIs, allowing us to measure calls for performance.
Data
: There are helper functions here to handle bytes within aData
blob. This is code used by nRF Connect for Mobile to read individual bytes from advertised BLEData
. The are functions to formatData
asString
as well.
Here's a listing of the iOS/iPadOS/macOS Projects we at Nordic use this code in. Obviously since this is Open Source, you're free to use any of it as well. We're just highlighting here some of the products that have lead to the battle-testing of some of this code.