Swiftpack.co - trilemma-dev/EmbeddedPropertyList as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Read property lists embedded inside of Mach-O executables (commonly Command Line Tools)
.package(url: "https://github.com/trilemma-dev/EmbeddedPropertyList.git", from: "1.0.1")

Using this framework you can read property lists embedded inside of a running executable as well as those of executables stored on disk. These types of executables are often Command Line Tools. Built-in support is provided for reading both embedded info and launchd property lists. Custom property list types can also be specified.


Property lists are returned as Data instances. Usually you'll want to deserialize using one of:

Example — Read Internal, Create Decodable

When running inside an executable, decode a launchd property list into a custom Decodable struct:

struct LaunchdPropertyList: Decodable {
    let machServices: [String : Bool]
    let label: String
    private enum CodingKeys: CodingKey, String {
        case machServices = "MachServices"
        case label = "Label"

let data = try EmbeddedPropertyListReader.launchd.readInternal()
let plist = try PropertyListDecoder().decode(LaunchdPropertyList.self, from: data)

Example — Read External, Create NSDictionary

For an external executable, deserialize an info property list as an NSDictionary:

let executableURL = URL(fileUrlWithPath: <# path here #>)
let data = try EmbeddedPropertyListReader.info.readExternal(from: executableURL)
let plist = try PropertyListSerialization.propertyList(from: data,
                                                       options: .mutableContainersAndLeaves,
                                                       format: nil) as? NSDictionary

Example — Create Decodable Using Version

Decode an info property list, using Version to decode the CFBundleVersion entry:

struct InfoPropertyList: Decodable {
    let bundleVersion: Version
    let bundleIdentifier: String
    private enum CodingKeys: CodingKey, String {
        case bundleVersion = "CFBundleVersion"
        case bundleIdentifier = "CFBundleIdentifier"

let data = try EmbeddedPropertyListReader.info.readInternal()
let plist = try PropertyListDecoder().decode(InfoPropertyList.self, from: data)


Stars: 0
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

1 week ago
  • Fixes documentation issue

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