Comments (7)
Hey @bgdn0 ,that's a very good suggestion, thanks for getting involved!
I'm a little concerned it'll break code for some people. On the other hand it makes sense to align images & colors. Let's give it a try π
from shark.
This is now life as per the 1.6.0 release.
from shark.
@bgdn0 So the feature is now working, we also get the nesting behavior for colors (it also uncovered a beautiful refactoring that got rid of a lot of duplicate code). That being said, it now feels a little weird for my projects that use Shark
.
I usually tend to put all colors into a Colors
folder, therefore after this change we'll go from:
view.backgroundColor = C.primaryRed
to
view.backgroundColor = C.Colors.primaryRed
So I would like to hear about your use cases and whether you organize color assets per folder when building applications.
from shark.
Hey @kaandedeoglu , cool, when can I expect the feature release to try it out?
We have separate Asset catalogs for Images and Colors.
Colors look something like this (simplified)
Colors.xcassets
βββ button
β βββ disabled.colorset
β βββ main.colorset
β βββ secondary.colorset
βββ input
β βββ active.colorset
β βββ error.colorset
β βββ inactive.colorset
β βββ placeholder.colorset
βββ list
β βββ background.colorset
β βββ separator.colorset
βββ text
βββ error.colorset
βββ main.colorset
βββ secondary.colorset
and the usage
button.backgroundColor = C.button.main
label.textColor = C.text.main
In one project we had colors gray1, ... gray6 and blue1, .... blue4, and it's not obvious should I use gray2 or gray4 for the text, so I prefer to name colors with something more meaningful and use namespaces
from shark.
Hey, the changes are now pushed to the namespaced_color_assets
branch, you'll have to build from source to test it:
Simply navigating to the root and doing swift build -c release --disable-sandbox
should give you an executable at .build/release/Shark
. Happy testing π§
from shark.
Works good for me π. Thank you! π
If you don't want to break Colors enum compatibility with the previous version, maybe it worth to add use-namespaces-for-colors as a command line option?
from shark.
Hi @bgdn0. When I started working on Shark with regards to the new framework-specific code generation, I was not aware of the namespaced_color_assets
branch. I think it's a good idea to bring this into master before working on the next features. I have just rebased it.
While working on this I noticed one gotcha⦠the nested namespace enum builder does not evaluate the corresponding Xcode setting yet. This can lead to confusion, hence going forward I'd rather evaluate the Xcode Provides Namespace setting than providing yet another command line option:
I'd also rework the image support then to honor that flag.
What do you think?
from shark.
Related Issues (20)
- Build error: The operation couldnβt be completed. (Utility.ArgumentParserError error 3.) HOT 1
- Please support Framework target HOT 1
- Build fails due to error related to localization HOT 2
- Shark.swift file contains invalid swift code when a particular font file is present HOT 1
- Run only, if necessary HOT 2
- No top-level namespace HOT 3
- NSDataAsset HOT 3
- Storyboard support HOT 4
- SwiftUI HOT 1
- Support for AppKit and SwiftUI HOT 5
- Automatic preview updating paused HOT 4
- Make enums CaseIterable HOT 5
- Change visibility from public HOT 2
- @const
- Swift Build Plugin
- Skip Preview Assets
- Enforcement `CaseIterable` needs to be optional HOT 6
- Build issue with XCode 7.3 HOT 1
- Build issue on XCode 8.3.3 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shark.