Skip to content

NordicPlayground/IOS-Common-Libraries

Repository files navigation

iOS-Common-Libraries

Nordic

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.

Contents

Colors

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.

Utilities

  • Cache: Need to use NSCache with a pure-Swift struct? This is what this is for. Also, it's just John Sundell's work in a library that we use.
  • BitField: Alternative to an enum Set that allows us to store everything in a single CPU Register, both in memory and as a Codable.
  • NordicLog: Apple added OSLog 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.

Extensions

  • Data: There are helper functions here to handle bytes within a Data blob. This is code used by nRF Connect for Mobile to read individual bytes from advertised BLE Data. The are functions to format Data as String as well.

In Use By

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages