Skip to content

Commit

Permalink
Fixes an issue when exporting resources to a Swift Package (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
subdan authored Jan 7, 2022
1 parent da450fd commit cb98b0a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Sources/FigmaExport/Subcommands/ExportColors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ extension FigmaExportCommand {

try fileWriter.write(files: files)

guard iosParams.xcassetsInSwiftPackage == false else {
checkForUpdate(logger: logger)
logger.info("Done!")
return
}

do {
let xcodeProject = try XcodeProjectWriter(xcodeProjPath: iosParams.xcodeprojPath, target: iosParams.target)
try files.forEach { file in
Expand All @@ -113,6 +119,8 @@ extension FigmaExportCommand {
} catch {
logger.error("Unable to add some file references to Xcode project")
}

logger.info("Done!")
}

private func exportAndroidColors(colorPairs: [AssetPair<Color>], androidParams: Params.Android) throws {
Expand Down
6 changes: 6 additions & 0 deletions Sources/FigmaExport/Subcommands/ExportIcons.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ extension FigmaExportCommand {
logger.info("Writting files to Xcode project...")
try fileWriter.write(files: localFiles)

guard params.ios?.xcassetsInSwiftPackage == false else {
checkForUpdate(logger: logger)
logger.info("Done!")
return
}

do {
let xcodeProject = try XcodeProjectWriter(xcodeProjPath: ios.xcodeprojPath, target: ios.target)
try localFiles.forEach { file in
Expand Down
6 changes: 6 additions & 0 deletions Sources/FigmaExport/Subcommands/ExportImages.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ extension FigmaExportCommand {
logger.info("Writting files to Xcode project...")
try fileWriter.write(files: localFiles)

guard params.ios?.xcassetsInSwiftPackage == false else {
checkForUpdate(logger: logger)
logger.info("Done!")
return
}

do {
let xcodeProject = try XcodeProjectWriter(xcodeProjPath: ios.xcodeprojPath, target: ios.target)
try localFiles.forEach { file in
Expand Down
2 changes: 2 additions & 0 deletions Sources/FigmaExport/Subcommands/ExportTypography.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ extension FigmaExportCommand {

try fileWriter.write(files: files)

guard iosParams.xcassetsInSwiftPackage == false else { return }

do {
let xcodeProject = try XcodeProjectWriter(xcodeProjPath: iosParams.xcodeprojPath, target: iosParams.target)
try files.forEach { file in
Expand Down

0 comments on commit cb98b0a

Please sign in to comment.