-
Notifications
You must be signed in to change notification settings - Fork 566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Can I generate extensions in iOS Swift? #719
Comments
Hi @antoniogamiz! Unfortunately right now there is no built-in format to generate a Swift extension for iOS. But I think it would be a good idea considering it is pretty common practice and makes using those colors easier. It would be a pretty straight-forward format to add, follow the |
Okay, I will try to implement it in the near future! Thanks for the fast response 😃 . |
Hi again @dbanksdesign, I have already created a PR with what I think is the correct way to implement this (I'm still learning all of this). I have found the following problem: when using colors, the default transformer (the one that uses extension Color {
static let oldPrimaryColor = Color(UIColor.systemIndigo)
static let darkGreyColor = Color("darkGrey")
static let greyColor = Color("grey")
static let lightGreyColor = Color("lightGrey")
static let greyBackgroundColor = Color("greyBackground")
static let blueBackgroundColor = Color("blueBackground")
static let darkRedColor = Color("darkRed")
} I would need to specify another transformer. As I have not found any transformer for |
That is correct, we will need a SwiftUI Color transformer |
PR made for the SwiftUI Color transformer, let me now if I need change something. |
In case anyone wants an example on how to create a Swift extension file, on your iOS swift file object in {
"source": [
"tokens/**/*.json"
],
"platforms": {
"ios-swift": {
"transforms": [
"..."
],
"buildPath": "files/ios-swift/",
"files": [
{
"destination": "MyCustomSpacing.swift",
"format": "ios-swift/any.swift",
"className": "CGFloat",
"filter": "foundation/spacing",
"options": {
"objectType": "extension"
}
}
]
}
}
} |
@tfmart I'm doing the same thing and it's working great. Shouldn't need any custom formats or templates for this. |
Closing question issue, considered as answered. |
Hi, I have been using Style Dictionary and it's great! Thanks a lot for the hard work.
I have a question. I have the following configuration file to generate styles sheets on iOS Swift from design tokens hosted on Invision App:
The result is something like this:
But, I would like to generate something like this:
Is that currently possible? Or would I need to create my own transformer? Thanks in advance (if this is not the place for this type of question, please redirect to the correct place if you which is, thanks! :))
The text was updated successfully, but these errors were encountered: