Skip to content

Commit

Permalink
[Feature] support idiom for icon (#39)
Browse files Browse the repository at this point in the history
* Added convenient extension method to XcodeExport module

* Make `icons` command to support device idiom

* Removed individualScales

* Updated parseNameAndIdiom param

* Added `dark` to FileContents initializers

* Removed singleScale case and updated ImagePack type to struct

* Added scale to FileContents initializers

* Update variables naming

* Added Scale enum case for fixing export result for svg assets

* Added test method for exporting iOS images

* Update export method and clean up code

* Updated XcodeIconsExporter and test cases

* Added missing @ symbol

* Fixed AssetPair export issue

* Updated Example app figma-export naming regular expression to support idiom

* Moved properties out of flatMap

* Updated iOS example assets

* Simplify create TemplateProperties
  • Loading branch information
yyjim authored Nov 18, 2020
1 parent b1f1394 commit eed4ffb
Show file tree
Hide file tree
Showing 32 changed files with 550 additions and 420 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic24Profile.pdf"
},
{
"idiom" : "ipad",
"filename" : "ic24Profile~ipad.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,56 +1,88 @@
{
"images" : [
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
"scale" : "1x",
"filename" : "[email protected]"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "1x"
"scale" : "2x",
"filename" : "[email protected]"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
"scale" : "3x",
"filename" : "[email protected]"
},
{
"idiom" : "ipad",
"scale" : "1x",
"filename" : "[email protected]"
},
{
"idiom" : "ipad",
"scale" : "2x",
"filename" : "[email protected]"
},
{
"idiom" : "ipad",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"idiom" : "ipad",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,56 +1,88 @@
{
"images" : [
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
"scale" : "1x",
"filename" : "[email protected]"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "1x"
"scale" : "2x",
"filename" : "[email protected]"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
"scale" : "3x",
"filename" : "[email protected]"
},
{
"idiom" : "ipad",
"scale" : "1x",
"filename" : "[email protected]"
},
{
"idiom" : "ipad",
"scale" : "2x",
"filename" : "[email protected]"
},
{
"idiom" : "ipad",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
"filename" : "[email protected]",
"scale" : "1x"
},
{
"idiom" : "ipad",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,56 +1,88 @@
{
"images" : [
{
"filename" : "[email protected]",
"idiom" : "ipad",
"scale" : "1x",
"filename" : "[email protected]"
},
{
"idiom" : "ipad",
"scale" : "2x",
"filename" : "[email protected]"
},
{
"idiom" : "universal",
"scale" : "2x"
"scale" : "1x",
"filename" : "[email protected]"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "1x"
"scale" : "2x",
"filename" : "[email protected]"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
"scale" : "3x",
"filename" : "[email protected]"
},
{
"idiom" : "universal",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"idiom" : "universal",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
},
{
"idiom" : "ipad",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"scale" : "1x"
},
{
"idiom" : "ipad",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
"filename" : "[email protected]",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ public extension UIImage {
static var ic24DropdownUp: UIImage { UIImage(named: #function, in: BundleProvider.bundle, compatibleWith: nil)! }
static var ic24FullscreenDisable: UIImage { UIImage(named: #function, in: BundleProvider.bundle, compatibleWith: nil)! }
static var ic24FullscreenEnable: UIImage { UIImage(named: #function, in: BundleProvider.bundle, compatibleWith: nil)! }
static var ic24Profile: UIImage { UIImage(named: #function, in: BundleProvider.bundle, compatibleWith: nil)! }
static var ic24ShareIos: UIImage { UIImage(named: #function, in: BundleProvider.bundle, compatibleWith: nil)! }
}
4 changes: 2 additions & 2 deletions Examples/Example/figma-export.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ common:
# [optional]
icons:
# [optional] RegExp pattern for icon name validation before exporting. Use to validate icon name in Figma file
nameValidateRegexp: '^(ic)_(\d\d)_([a-z0-9_]+)$' # RegExp pattern for: ic_24_icon_name, ic_24_icon
nameValidateRegexp: '^(ic)_(\d\d)_([a-z0-9_~]+)$' # RegExp pattern for: ic_24_icon_name, ic_24_icon
# [optional]
images:
# [optional] RegExp pattern for image name validation before exporting. Use to validate image name in Figma file
nameValidateRegexp: '^(img)_([a-z0-9_]+)$' # RegExp pattern for: img_zero_empty, img_widget_large
nameValidateRegexp: '^(img)_([a-z0-9_~]+)$' # RegExp pattern for: img_zero_empty, img_widget_large

# [optional] iOS export parameters
ios:
Expand Down
Loading

0 comments on commit eed4ffb

Please sign in to comment.