From 32beaa1cfc6023a113ed9cfdb3a3381e6e353329 Mon Sep 17 00:00:00 2001 From: ryoya ito Date: Sat, 27 Aug 2022 02:55:45 +0900 Subject: [PATCH] introduce swiftgen --- .../xcshareddata/swiftpm/Package.resolved | 14 ++++++++++++++ app-ios/Package.resolved | 14 ++++++++++++++ app-ios/Package.swift | 16 +++++++++++++++- app-ios/Sources/AppFeature/AppView.swift | 3 ++- app-ios/Sources/Strings/L10n.swift | 1 + .../Resources/en.lproj/Localizable.strings | 1 + .../Resources/ja.lproj/Localizable.strings | 1 + app-ios/Sources/Strings/swiftgen.yml | 11 +++++++++++ 8 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 app-ios/DroidKaigi2022/DroidKaigi2022.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved create mode 100644 app-ios/Package.resolved create mode 100644 app-ios/Sources/Strings/L10n.swift create mode 100644 app-ios/Sources/Strings/Resources/en.lproj/Localizable.strings create mode 100644 app-ios/Sources/Strings/Resources/ja.lproj/Localizable.strings create mode 100644 app-ios/Sources/Strings/swiftgen.yml diff --git a/app-ios/DroidKaigi2022/DroidKaigi2022.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/app-ios/DroidKaigi2022/DroidKaigi2022.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 000000000..5d88d85a2 --- /dev/null +++ b/app-ios/DroidKaigi2022/DroidKaigi2022.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,14 @@ +{ + "pins" : [ + { + "identity" : "swiftgenplugin", + "kind" : "remoteSourceControl", + "location" : "https://github.com/SwiftGen/SwiftGenPlugin", + "state" : { + "revision" : "879b85a470cacd70c19e22eb7e11a3aed66f4068", + "version" : "6.6.2" + } + } + ], + "version" : 2 +} diff --git a/app-ios/Package.resolved b/app-ios/Package.resolved new file mode 100644 index 000000000..5d88d85a2 --- /dev/null +++ b/app-ios/Package.resolved @@ -0,0 +1,14 @@ +{ + "pins" : [ + { + "identity" : "swiftgenplugin", + "kind" : "remoteSourceControl", + "location" : "https://github.com/SwiftGen/SwiftGenPlugin", + "state" : { + "revision" : "879b85a470cacd70c19e22eb7e11a3aed66f4068", + "version" : "6.6.2" + } + } + ], + "version" : 2 +} diff --git a/app-ios/Package.swift b/app-ios/Package.swift index b125ee734..45d2fcee8 100644 --- a/app-ios/Package.swift +++ b/app-ios/Package.swift @@ -5,6 +5,7 @@ import PackageDescription let package = Package( name: "DroidKaigiPackage", + defaultLocalization: "en", platforms: [ .iOS(.v15), ], @@ -12,14 +13,27 @@ let package = Package( .library( name: "AppFeature", targets: ["AppFeature"]), + .library(name: "Strings", targets: ["Strings"]), ], dependencies: [ + .package(url: "https://github.com/SwiftGen/SwiftGenPlugin", from: "6.6.2"), ], targets: [ .target( name: "AppFeature", dependencies: [ - .target(name: "TimetableFeature") + .target(name: "Strings"), + .target(name: "TimetableFeature"), + ] + ), + .target( + name: "Strings", + resources: [ + .process("swiftgen.yml"), + .process("Resources"), + ], + plugins: [ + .plugin(name: "SwiftGenPlugin", package: "SwiftGenPlugin"), ] ), .target( diff --git a/app-ios/Sources/AppFeature/AppView.swift b/app-ios/Sources/AppFeature/AppView.swift index 889b46a61..c6fe7cf1c 100644 --- a/app-ios/Sources/AppFeature/AppView.swift +++ b/app-ios/Sources/AppFeature/AppView.swift @@ -1,4 +1,5 @@ import SwiftUI +import Strings import TimetableFeature public struct AppView: View { @@ -14,7 +15,7 @@ public struct AppView: View { TabView(selection: $selectedTab) { TimetableView(timetable: .companion.fake()) .tabItem { - Label("Timetable", systemImage: "questionmark.circle") + Label(L10n.Timetable.title, systemImage: "questionmark.circle") } } } diff --git a/app-ios/Sources/Strings/L10n.swift b/app-ios/Sources/Strings/L10n.swift new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/app-ios/Sources/Strings/L10n.swift @@ -0,0 +1 @@ + diff --git a/app-ios/Sources/Strings/Resources/en.lproj/Localizable.strings b/app-ios/Sources/Strings/Resources/en.lproj/Localizable.strings new file mode 100644 index 000000000..5acd4e5df --- /dev/null +++ b/app-ios/Sources/Strings/Resources/en.lproj/Localizable.strings @@ -0,0 +1 @@ +"Timetable.Title" = "Timetable"; diff --git a/app-ios/Sources/Strings/Resources/ja.lproj/Localizable.strings b/app-ios/Sources/Strings/Resources/ja.lproj/Localizable.strings new file mode 100644 index 000000000..5acd4e5df --- /dev/null +++ b/app-ios/Sources/Strings/Resources/ja.lproj/Localizable.strings @@ -0,0 +1 @@ +"Timetable.Title" = "Timetable"; diff --git a/app-ios/Sources/Strings/swiftgen.yml b/app-ios/Sources/Strings/swiftgen.yml new file mode 100644 index 000000000..16d6ecd36 --- /dev/null +++ b/app-ios/Sources/Strings/swiftgen.yml @@ -0,0 +1,11 @@ +input_dir: Resources/ +output_dir: ${DERIVED_SOURCES_DIR}/ + +strings: + inputs: en.lproj + filter: .+\.strings$ + outputs: + templateName: structured-swift5 + output: L10n.generated.swift + params: + publicAccess: true