kandi X-RAY | SwiftGen Summary
kandi X-RAY | SwiftGen Summary
SwiftGen is a tool to automatically generate Swift code for resources of your projects (like images, localised strings, etc), to make them type-safe to use.
Top functions reviewed by kandi - BETA
SwiftGen Key Features
SwiftGen Examples and Code Snippets
Trending Discussions on SwiftGen
Xcode 13 gives me a hard time building my project which consists of targets with build phases that generate code.
E.g. one build phase generates the file
Secrets+Generated.swift by simply using a shell script that echoes some code into that file.
The build phase defines that file as an output file. No input file, no input file list and no output file list, as only that one file is created/modified.
Almost all the time when building the project, the build fails:...
ANSWERAnswered 2021-Sep-24 at 09:06
So I cloned an existing repository from GitHub and tried the pods on my device(MacBook Pro M1 2020 bigSur 11.6 and Xcode 13) Cocoapods was not working as expected so I looked it up online and after trying to open using Rosetta and installing ffi gem I managed to install most of the pods. However, these 2 errors keep showing up:
- No such module 'MapboxCommon_Private'
- Failed to build module 'MapboxSearch'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.4.2 (swiftlang-1184.108.40.206 clang-1220.127.116.11)', while this compiler is 'Apple Swift version 5.5 (swiftlang-1300.0.31.1 clang-1300.0.29.1)'). Please select a toolchain which matches the SDK.
The pod file looks like this:...
ANSWERAnswered 2021-Oct-07 at 00:44
It turns out that this pod was causing the problem:
I'm wondering, how localization works with the swift package. I saw the WWDC20/10169 video - Swift packages: Resources and localization. I'm trying to do the same things within my own project.
If I do same configuration (as on WWDC video) and add
.environment(\.locale, Locale(identifier: "es")) to
View preview, it works (but only when test inside sp).
The problems start when I try to use localized resources inside the actual app.
The process is very simple - I just use a view with a localized string from the package inside the app. For test purposes I launch my app with a specific locale (scheme settings) - the result, I always get
ANSWERAnswered 2021-Mar-22 at 05:08
I found the reason for this issue - the app itself require localization and setting it in project settings it's not enough, instead, we also should add CFBundleLocalizations in info plist with required localizations as an Array of strings. Even if in official doc says that is's support only few localizations, we can add additional one there (using same locale code as lproj folders) and everything will works.
I installed the latest (6.4.0, October 2020) version of SwiftGen via Homebrew on a new MacBook Pro M1 running Big Sur (11.1), but every time I try to run it, it's killed, and the console says that it's because
EXC_BAD_ACCESS (Code Signature Invalid).
The 6.4.0 binary downloaded straight from the GitHub release page works. This sounds like there's a problem with the Homebrew version.
Who is responsible for fixing the Homebrew version?
I can replace the Homebred-installed one (at
/usr/bin/local/swiftgen) with the downloaded binary, but the download also contains a number of frameworks and stencils. Where those should be copied to?
The relevant console bits are:...
ANSWERAnswered 2021-Mar-05 at 05:06
I solved the second part of my question. The unzipped files need to be copied to
No vulnerabilities reported
Go to the GitHub page for the latest release
Download the swiftgen-x.y.z.zip file associated with that release
Extract the content of the zip archive in your project directory
If you have homebrew installed, you can use the following command to build and install the latest commit:
Alternatively, you can clone the repository and use rake cli:install to build the tool and install it from any branch, which could be useful to test SwiftGen in a fork or a Pull Request branch.
Starting with SwiftGen 6.2.1, if you get an error similar to dyld: Symbol not found: _$s11SubSequenceSlTl when running SwiftGen, you'll need to install the Swift 5 Runtime Support for Command Line Tools.
Update to macOS 10.14.4 or later
Install Xcode 10.2 or later at /Applications/Xcode.app
Rebuild SwiftGen from source using Xcode 10.2 or later
Reuse Trending Solutions
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page