yujingaya / generate-device

A command line utility to generate Swift enum `Device` that lists devices in Xcode device database.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A command line utility to generate Device.swift that lists devices in Xcode device database.

Install

$ mint install yujingaya/generate-device

Run

$ mint run generate-device "$(xcode-select -p)/Platforms/iPhoneOS.platform/usr/standalone/device_traits.db"

This will produce swift code like below, to the standard output.

// Generated by generate-device.
// https://github.com/yujingaya/generate-device

import Darwin

enum Device: String, RawRepresentable, CaseIterable, Equatable, Hashable, Codable {
    /// Mac.
    case macFamily20_1 = "MacFamily20,1"

    /// iPad mini (5th generation).
    case iPad11_1 = "iPad11,1"

    /// iPad mini (5th generation).
    case iPad11_2 = "iPad11,2"

// ...

Help

$ mint run generate-device --help
OVERVIEW: Generate Device.swift from a device_traits.db file

USAGE: generate-device [--output <output>] <device-traits>

ARGUMENTS:
  <device-traits>         The path to device_traits.db file

OUTPUT FORMAT:
  --public/--internal     Set access level modifier for Device enumeration (default: --internal)

OPTIONS:
  -m, --minimum-deployment-target <minimum-deployment-target>
                          Omit devices that doesn't support specified deployment target
  -o, --output <output>   Write output to a specified file
  --version               Show the version.
  -h, --help              Show help information.

About

A command line utility to generate Swift enum `Device` that lists devices in Xcode device database.


Languages

Language:Swift 100.0%