kaandedeoglu / shark Goto Github PK
View Code? Open in Web Editor NEWSwift CLI for strong-typing images, colors, storyboards, fonts and localizations
License: MIT License
Swift CLI for strong-typing images, colors, storyboards, fonts and localizations
License: MIT License
I'm not sure if this is actually possible, but can we make the generated enums conform to CaseIterable? The use case here is that I have a list of images in my preview assets for testing purposes, and I need to put them in a long list. Without CaseIterable, I need to manually make the array of images.
Would be nice if we could change the default visibility from public
to e.g. internal
It might be worth noting that this is an iOS app, given that it seems to be looking in the macOS toolchain.
dyld: lazy symbol binding failed: Symbol not found: __TFesRxs10Collectionwx8IteratorzGVs16IndexingIteratorx_wx8_ElementzWxS0_7Element_rS_12makeIteratorfT_GS1_x_
Referenced from: /Users/ericmarkmartin/Developments/Trigger/iOSApp/Trigger/Pods/Shark/shark
Expected in: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libswiftCore.dylib
dyld: Symbol not found: __TFesRxs10Collectionwx8IteratorzGVs16IndexingIteratorx_wx8_ElementzWxS0_7Element_rS_12makeIteratorfT_GS1_x_
Referenced from: /Users/ericmarkmartin/Developments/Trigger/iOSApp/Trigger/Pods/Shark/shark
Expected in: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libswiftCore.dylib
/Users/ericmarkmartin/Library/Developer/Xcode/DerivedData/Trigger-cxxjofophvubgoaphyfavfngywyx/Build/Intermediates/Trigger.build/Debug-iphonesimulator/Trigger.build/Script-8813BC861F06A74300EA08A3.sh: line 2: 55552 Abort trap: 6 "$PODS_ROOT/Shark/shark" "${PROJECT_DIR}/${PROJECT_NAME}/Images.xcassets" "${PROJECT_DIR}/${PROJECT_NAME}"
Command /bin/sh failed with exit code 134
in line 28 of XcodeProjectHelper.swift ; I know you might want to eliminates Tests & Aggregate target but this eliminates SDK targets also
let applicationTargets = xcodeproj.pbxproj.nativeTargets.filter({ $0.productType == .application })
the generated code doesn't contain Bundle information, so it will fail for framework bundle
Would it be possible to add support for enum
ifying Storyboards, e.g. accessing Main.storyboard
as R.S.Main
?
(I'd have a go at a pull request, if you don't have the time for it – although I would need some guidance… 😄)
SwiftUI apps usually contain a folder with assets that are only used for the SwiftUI Preview mechanism in Xcode. Shark should ignore that folder, since the assets contained in there are not shipped, hence not accessible, in the final binary.
PhaseScriptExecution Run\ Script\ -\ Shark /Users/gsimmons/Library/Developer/Xcode/DerivedData/CareConsult-etlsolxnmuijbhfkgvpwykbilvup/Build/Intermediates/CareConsult.build/Debug-iphonesimulator/CareConsult.build/Script-6DB712881BA9A9DD0031CBE7.sh
cd /Users/gsimmons/Developer/CenseoHealth/CareConsult
/bin/sh -c /Users/gsimmons/Library/Developer/Xcode/DerivedData/CareConsult-etlsolxnmuijbhfkgvpwykbilvup/Build/Intermediates/CareConsult.build/Debug-iphonesimulator/CareConsult.build/Script-6DB712881BA9A9DD0031CBE7.sh
/Users/gsimmons/Library/Developer/Xcode/DerivedData/CareConsult-etlsolxnmuijbhfkgvpwykbilvup/Build/Intermediates/CareConsult.build/Debug-iphonesimulator/CareConsult.build/Script-6DB712881BA9A9DD0031CBE7.sh: line 2: Creating: command not found
Command /bin/sh failed with exit code 127
It would be nice to have support for the new string catalogues. They are a good addition, but fail to add typesafe enums like we do.
Unless you run the Shark script with "For install builds only", the automatic preview of SwiftUI in Xcode keeps popping up "Automatic preview updating paused". I'm guessing this is because it detects changes to the relevant source code.
It would be great, if Shark
was able to work with SwiftUI, in particular for multi-platform projects. For this to happen, we probably need to remove all references to UIKit
and work with the SwiftUI-provided abstractions, such as Color
and Image
.
I realize I can adjust the top-level namespace with the --name
argument and bring the namespaces into the top level area via typealias
es, but would it be possible to get rid of the top-level namespace altogether?
Great project. Lean and mean, no hidden magic, it just works!
That said, is there an easy way to run it only after the .xcodeproj
file has been updated?
Hey,
It does not works when the project has a LaunchImage. It creates the following code for LaunchImage:
public enum LaunchImage.launchimage {
}
which causes a build time crash.
Now that build time constant values are likely to surface in the language, we should ponder whether it‘s a good fit for Shark‘s generated files.
Today I learned about NSDataAsset, which would come in handy for, e.g. sounds, level maps, or what not. NSDataAsset
s are also stored in the asset catalogue, so it might be cool to support them in shark.
Hello,
Is it possible to add nested namespaces support for generated Colors enum (the same way as for Images enum) ?
I am running shark using the following command
if [ -x "$(command -v shark)" ]; then
shark "$PROJECT_FILE_PATH" "$PROJECT_DIR/$PROJECT_NAME"
else
echo "error: shark not installed, run command brew install kaandedeoglu/formulae/shark"
fi
It fails with following error
Fatal error: Error raised at top level: Shark.LocalizationBuilderError.invalidLocalizableStringsFile(path: "/Users/username/app-name/app-name/app-name/Base.lproj/LaunchScreen.storyboard/en.lproj/LaunchScreen.strings"): file /BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-1001.8.63.13/swift/stdlib/public/core/ErrorType.swift, line 200
Localization is enabled for the LaunchScreen.storyboard
.
The LaunchScreen.storyboard
is found at file path /Users/username/app-name/app-name/app-name/Base.lproj/LaunchScreen.storyboard
.
The LaunchScreen.strings
file for English is found at file path /Users/username/app-name/app-name/app-name/en.lproj/LaunchScreen.strings
and not at the file path mentioned in the error (/Users/username/app-name/app-name/app-name/Base.lproj/LaunchScreen.storyboard/en.lproj/LaunchScreen.strings
)
By making all the enums CaseIterable
you essentially breaking all the projects which have their resources separated in different folders, cause now all the resources of the same type are under one huge enum, instead of the nested ones. Have to fork the tool to fix it now.
I have installed Shark
using Homebrew.
Build script is
if [ -x "$(command -v shark)" ]; then
shark $PROJECT_FILE_PATH $PROJECT_DIR/$PROJECT_NAME
else
echo "error: shark not installed, run command brew install kaandedeoglu/formulae/shark"
fi
I have a font file with name "Lato-Light.ttf". (https://fonts.google.com/specimen/Lato)
The code generated for this font is
public enum F {
public static func lato-light(ofSize size: CGFloat) -> UIFont { return UIFont(name: "Lato-Light", size: size)! }
}
The font name contains hyphen and is invalid swift code.
P.S.- I have several other font files with hyphen in their file names. However, Shark generates correct snakeCase font names for those files. The issue is seen only for this particular font file
Wondering if you had run into this similar project. Any thoughts on implementing similar functionality in Shark?
With all the work on Swift Build Plugins – which found its way into Xcode 14 – we should create a Swift Build Plugin that relieves users from having to edit the Xcode build phases to run Shark.
This would increase usability with CI/CD as well, such as that we wouldn't have to add the generated file(s) into the SCM.
Did you ever consider adjusting Shark for AppKit?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.