A Swift package providing AppCategory
, a strongly-typed enum for Apple's LSApplicationCategoryType
constants.
This makes it easier and safer to work with application categories in your Swift projects. The AppCategory
enum includes cases for standard Apple-defined categories (including various game sub-categories) and provides useful properties:
rawValue
: The original string constant (e.g.,"public.app-category.business"
).id
: Same asrawValue
, useful forIdentifiable
conformance.description
: A human-readable string (e.g.,"Business"
).sfSymbol
: An SFSymbol name string (e.g.,"briefcase.fill"
).emoji
: An emoji string (e.g., "💼").
Assuming you have added LSAppCategory
as a dependency to your project:
import LSAppCategory
let category = AppCategory.developerTools
print("Category: \(category.description)")
// Output: Category: Developer Tools
print("SF Symbol: \(category.sfSymbol)")
// Output: SF Symbol: hammer.fill
print("Emoji: \(category.emoji)")
// Output: Emoji: 🛠️
print("Raw Value: \(category.rawValue)")
// Output: Raw Value: public.app-category.developer-tools
Add the following to your Package.swift
file:
dependencies: [
.package(url: "https://github.com/hewig/LSAppCategory.git", branch: "main"),
]
And add LSAppCategory
to your target's dependencies:
targets: [
.target(
name: "YourTarget",
dependencies: ["LSAppCategory"]
),
]
- Open your Xcode project.
- Go to File > Swift Packages > Add Package Dependency...
- Enter the URL of this repository:
https://github.com/hewig/LSAppCategory.git
- Select the branch
main
. - Add the package to your target.