Skip to content

Instantly share code, notes, and snippets.

@zac
Created April 1, 2020 23:54
Show Gist options
  • Save zac/824b89b5927f51a3cb7327f0051b99ef to your computer and use it in GitHub Desktop.
Save zac/824b89b5927f51a3cb7327f0051b99ef to your computer and use it in GitHub Desktop.
import Foundation
let env = ProcessInfo.processInfo.environment
guard let deviceFamily = env["TARGETED_DEVICE_FAMILY"],
let projectPath = env["PROJECT_DIR"],
let project = env["PROJECT"] else {
exit(1)
}
var idioms: Set<Idiom> = [.marketing]
if deviceFamily.contains("1") {
idioms.insert(.iPhone)
}
if deviceFamily.contains("2") {
idioms.insert(.iPad)
}
idioms.insert(.marketing)
let set = IconSet(idioms: idioms, view: Icon())
try! set.write(
to: URL(fileURLWithPath: projectPath)
.appendingPathComponent(project)
.appendingPathComponent("Assets.xcassets")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment