Skip to content
This repository has been archived by the owner on Jun 8, 2020. It is now read-only.

Commit

Permalink
Updating output file format (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandodelrio committed Dec 6, 2017
1 parent 8b1d8d8 commit 24b547d
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 4 deletions.
54 changes: 54 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Change Log

## [0.5.1](https://github.com/fernandodelrio/SwiftColorGen/releases/tag/0.5.1)

### Updated
- Based on the sugestion #12, generating the colors as computed properties, instead of a class function

## [0.5.0](https://github.com/fernandodelrio/SwiftColorGen/releases/tag/0.5.0)

### Added
- Adding support for multiple color spaces (now you don't need to select only the sRGB color space to work with the generator)

## [0.4.1](https://github.com/fernandodelrio/SwiftColorGen/releases/tag/0.4.1)

### Fixed
- Fixed #1 (Invalid color functions generated)

## [0.4.0](https://github.com/fernandodelrio/SwiftColorGen/releases/tag/0.4.0)

### Added
- Allowing re-runs of the tool in the same code
- Adding support for custom colors defined for the user

## [0.3.3](https://github.com/fernandodelrio/SwiftColorGen/releases/tag/0.3.3)

### Fixed
- Fixed the output file not including the import to UIKit

## [0.3.1](https://github.com/fernandodelrio/SwiftColorGen/releases/tag/0.3.1)

### Added
- Added CocoaPods support

## [0.3.0](https://github.com/fernandodelrio/SwiftColorGen/releases/tag/0.3.0)

### Updated
- Improved existing CLI interface:
- Cleaner input
- Making some parameters, optional
- Reworked naming convention in the generated Swift file

## [0.2.0](https://github.com/fernandodelrio/SwiftColorGen/releases/tag/0.2.0)

### Updated
- Update name generation, supporting web color names: https://en.wikipedia.org/wiki/Web_colors


## [0.1.0](https://github.com/fernandodelrio/SwiftColorGen/releases/tag/0.1.0)

First release of the tool, featuring:

- Swift Code and Asset generation
- RGBA hex color name generation
- Support for sRGB color space
2 changes: 1 addition & 1 deletion SwiftColorGen.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SwiftColorGen"
s.version = "0.5.0"
s.version = "0.5.1"
s.summary = "A tool that generate code for Swift projects, designed to improve the maintainability of UIColors"
s.description = <<-DESC
A tool that generate code for Swift projects, designed to improve the maintainability of UIColors.
Expand Down
6 changes: 3 additions & 3 deletions SwiftColorGen/Utils/OutputFileManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class OutputFileManager {
generatorData.forEach { data in
output += "\t/// Color #\(data.color.name)\n"
if data.outputNeedsPrefix {
output += "\tclass func gen\(data.outputName)() -> UIColor {\n"
output += "\tstatic var gen\(data.outputName): UIColor {\n"
} else {
output += "\tclass func \(data.outputName)Color() -> UIColor {\n"
output += "\tstatic var \(data.outputName)Color: UIColor {\n"
}
output += "\t\treturn UIColor(named: \"\(data.assetName)\") ?? .clear\n"
output += "\t}\n\n"
Expand All @@ -29,7 +29,7 @@ class OutputFileManager {
assets.forEach { asset in
let name = getCustomColorOutputname(name: asset.currentName ?? "")
output += "\t/// Color #\(asset.color?.name ?? "")\n"
output += "\tclass func \(name)() -> UIColor {\n"
output += "\tstatic var \(name): UIColor {\n"
output += "\t\treturn UIColor(named: \"\(asset.currentName ?? "")\") ?? .clear\n"
output += "\t}\n\n"
}
Expand Down

0 comments on commit 24b547d

Please sign in to comment.