Swiftpack.co - RougeWare/Swift-Introspection as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by RougeWare.
RougeWare/Swift-Introspection 1.2.0
Aides in checking information about the current app, system, & device
⭐️ 1
🕓 2 years ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/RougeWare/Swift-Introspection.git", from: "1.2.0")

Tested on GitHub Actions

Swift 5 swift package manager 5.2 is supported Supports macOS, iOS, tvOS, watchOS, Linux, & Windows

Introspection

A Swift package which aides in checking information about the current app, system, & device.

The app bundle

This includes some sugar for reading your app bundle:

import Introspection

Introspection.bundleId   // The ID of the main bundle, as read from its info dictionary (e.g. `com.acme.MyApp`)
Introspection.appName    // The name of your app, as read from its bundle info
Introspection.appVersion // The semantic version of your app, as read from its bundle info, parsed into a `SemVer` value

This package also includes a generic version reader for any bundle:

import Introspection

Introspection.Bundle.id(of: Bundle(for: SomeClass.self))
Introspection.Bundle.name(of: Bundle(for: SomeClass.self))
Introspection.Bundle.version(of: Bundle(for: SomeClass.self))

And makes general bundle access easier:

import Introspection

let accentColorName: String? = Introspection.Bundle["NSAccentColorName"]
let supportedPlatforms: [String]? = Introspection.Bundle["CFBundleSupportedPlatforms"]

The device

This also lets you check info about the current device:

import Introspection

Introspection.Device.modelType == .iPhone
Introspection.Device.class == .laptop

GitHub

link
Stars: 1
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

1.2 - Added Bundle ID
2 years ago

Added the ability to read the bundle ID with any of these:

Introspection.Bundle.id
Introspection.Bundle.id(of: .main) // Or any other Foundation.Bundle instance
Introspection.bundleId
Bundle.main.id // Or any other Foundation.Bundle instance

Also:

  • Also updated SemVer to 3.0.0-Beta.5
  • Also resolved other packages
  • Support for iOS device info

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