mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
63 lines
1.2 KiB
Swift
63 lines
1.2 KiB
Swift
//
|
|
// ProjectExtensions.swift
|
|
// XcodeGen
|
|
//
|
|
// Created by Yonas Kolb on 19/7/17.
|
|
//
|
|
//
|
|
|
|
import Foundation
|
|
import xcodeproj
|
|
import PathKit
|
|
|
|
extension Array where Element: ProjectElement {
|
|
|
|
var referenceList: [String] {
|
|
return map { $0.reference }
|
|
}
|
|
|
|
var referenceSet: Set<String> {
|
|
return Set(referenceList)
|
|
}
|
|
}
|
|
|
|
extension BuildSettings {
|
|
|
|
init() {
|
|
dictionary = [:]
|
|
}
|
|
|
|
static var empty = BuildSettings()
|
|
|
|
func merged(_ buildSettings: BuildSettings) -> BuildSettings {
|
|
var mergedSettings = self
|
|
mergedSettings.merge(buildSettings)
|
|
return mergedSettings
|
|
}
|
|
|
|
mutating func merge(_ buildSettings: BuildSettings) {
|
|
for (key, value) in buildSettings.dictionary {
|
|
dictionary[key] = value
|
|
}
|
|
}
|
|
}
|
|
|
|
func +=( lhs: inout BuildSettings, rhs: BuildSettings?) {
|
|
guard let rhs = rhs else { return }
|
|
lhs.merge(rhs)
|
|
}
|
|
|
|
extension PBXProductType {
|
|
|
|
init?(string: String) {
|
|
if let type = PBXProductType(rawValue: string) {
|
|
self = type
|
|
} else if let type = PBXProductType(rawValue: "com.apple.product-type.\(string)") {
|
|
self = type
|
|
} else {
|
|
return nil
|
|
}
|
|
}
|
|
}
|
|
|