Skip to content
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

Use SwiftGen via SPM Plugin #42

Merged
merged 1 commit into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Generate code"
scriptText = "cd &quot;${PROJECT_DIR}&quot;&#10;exec &gt; prebuild.log 2&gt;&amp;1 # For debugging&#10;scripts/twine.sh&#10;scripts/swiftgen.sh&#10;scripts/sourcery.sh&#10;scripts/apollo.sh&#10;">
scriptText = "cd &quot;${PROJECT_DIR}&quot;&#10;exec &gt; prebuild.log 2&gt;&amp;1 # For debugging&#10;scripts/twine.sh&#10;scripts/sourcery.sh&#10;scripts/apollo.sh&#10;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Generate code"
scriptText = "cd &quot;${PROJECT_DIR}&quot;&#10;exec &gt; prebuild.log 2&gt;&amp;1 # For debugging&#10;scripts/twine.sh&#10;scripts/swiftgen.sh&#10;scripts/sourcery.sh&#10;scripts/apollo.sh&#10;">
scriptText = "cd &quot;${PROJECT_DIR}&quot;&#10;exec &gt; prebuild.log 2&gt;&amp;1 # For debugging&#10;scripts/twine.sh&#10;scripts/sourcery.sh&#10;scripts/apollo.sh&#10;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Generate code"
scriptText = "cd &quot;${PROJECT_DIR}&quot;&#10;exec &gt; prebuild.log 2&gt;&amp;1 # For debugging&#10;scripts/twine.sh&#10;scripts/swiftgen.sh&#10;scripts/sourcery.sh&#10;scripts/apollo.sh&#10;">
scriptText = "cd &quot;${PROJECT_DIR}&quot;&#10;exec &gt; prebuild.log 2&gt;&amp;1 # For debugging&#10;scripts/twine.sh&#10;scripts/sourcery.sh&#10;scripts/apollo.sh&#10;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,15 @@
"revision" : "7e2c5f3cbbeea68e004915e3a8961e20bd11d824",
"version" : "1.18.0"
}
},
{
"identity" : "swiftgenplugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SwiftGen/SwiftGenPlugin",
"state" : {
"revision" : "879b85a470cacd70c19e22eb7e11a3aed66f4068",
"version" : "6.6.2"
}
}
],
"version" : 2
Expand Down
1 change: 0 additions & 1 deletion ios/Mintfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
SwiftGen/[email protected]
realm/[email protected]
krzysztofzablocki/[email protected]
11 changes: 10 additions & 1 deletion ios/PresentationLayer/UIToolkit/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ let package = Package(
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(name: "Utilities", path: "../DomainLayer/Utilities")
.package(name: "Utilities", path: "../DomainLayer/Utilities"),
.package(url: "https://github.com/SwiftGen/SwiftGenPlugin", .upToNextMajor(from: "6.6.0"))
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand All @@ -26,6 +27,14 @@ let package = Package(
name: "UIToolkit",
dependencies: [
.product(name: "Utilities", package: "Utilities")
],
exclude: [
"swiftgen-strings.stencil",
"swiftgen-xcassets.stencil",
"swiftgen.yml"
],
plugins: [
.plugin(name: "SwiftGenPlugin", package: "SwiftGenPlugin")
]
)
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Template is based on the default strings/flat-swift5.stencil
// It is modified to use snake_case instead of camelCase in order to make it more handy in a combination with twine
// This is done by changing `swiftIdentifier:"pretty"` to `swiftIdentifier`
// https://github.com/SwiftGen/SwiftGen/blob/stable/Sources/SwiftGenCLI/templates/strings/flat-swift5.stencil

// Modifications:
// - Use `.myModule` [workaround](https://developer.apple.com/forums/thread/664295) to address SwiftUI Previews crashes
// - Use snake_case instead of camelCase, this is done by changing `swiftIdentifier:"pretty"` to `swiftIdentifier`
// - Ability to change localization via Environment.localization

// swiftlint:disable all
// Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Template is just a clone of the default xcassets/swift5.stencil (to make it work with Mint)
// Template is based on the default xcassets/swift5.stencil
// https://github.com/SwiftGen/SwiftGen/blob/stable/Sources/SwiftGenCLI/templates/xcassets/swift5.stencil

// Modifications:
// - Use `.myModule` [workaround](https://developer.apple.com/forums/thread/664295) to address SwiftUI Previews crashes

// swiftlint:disable all
// Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen

Expand Down
21 changes: 21 additions & 0 deletions ios/PresentationLayer/UIToolkit/Sources/UIToolkit/swiftgen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
input_dir: Resources
output_dir: ${DERIVED_SOURCES_DIR}

strings:
inputs:
- Localizable/Base.lproj/Localizable.strings
outputs:
- templatePath: swiftgen-strings.stencil
output: Localizable.generated.swift
params:
publicAccess: true

xcassets:
inputs:
- Colors.xcassets
- Images.xcassets
outputs:
- templatePath: swiftgen-xcassets.stencil
output: Assets.generated.swift
params:
publicAccess: true
7 changes: 0 additions & 7 deletions ios/scripts/swiftgen.sh

This file was deleted.